I close BIP27. I won't be pursuing BIPs anymore

Ethan Watson via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 20 03:23:40 PDT 2016


On Wednesday, 19 October 2016 at 10:32:56 UTC, Walter Bright 
wrote:
> Better:
>
>    void f(ref Vector v);
>    void f(Vector v) { f(v); }
>
>    f(Vector(10,20,30));

Suitable enough for simple functions. But beyond that becomes 
maintenance hell.

For example:

void func2( ref const( Vector ) v1, ref const( Vector ) v2 );

Requires the following permutations:

void func2( const( Vector ) v1, ref const( Vector ) v2 ) { func2( 
v1, v2 ); }
void func2( ref const( Vector ) v1, const( Vector ) v2 ) { func2( 
v1, v2 ); }
void func2( const( Vector ) v1, const( Vector ) v2 ) { func2( v1, 
v2 ); }

For example:

void func3( ref const( Vector ) v1, ref const( Vector ) v2, ref 
const( Vector ) v3 );

Requires the following permutations:

void func3( const( Vector ) v1, const( Vector ) v2, const( Vector 
) v3 ) { func3( v1, v2, v3 ); }
void func3( ref const( Vector ) v1, const( Vector ) v2, const( 
Vector ) v3 ) { func3( v1, v2, v3 ); }
void func3( ref const( Vector ) v1, ref const( Vector ) v2, 
const( Vector ) v3 ) { func3( v1, v2, v3 ); }
void func3( ref const( Vector ) v1, const( Vector ) v2, ref 
const( Vector ) v3 ) { func3( v1, v2, v3 ); }
void func3( const( Vector ) v1, ref const( Vector ) v2, ref 
const( Vector ) v3 ) { func3( v1, v2, v3 ); }
void func3( const( Vector ) v1, const( Vector ) v2, ref const( 
Vector ) v3 ) { func3( v1, v2, v3 ); }
void func3( const( Vector ) v1, ref const( Vector ) v2, const( 
Vector ) v3 ) { func3( v1, v2, v3 ); }

Did I miss one in that block? I think I missed one. Thus my 
point. If you were to provide something that Just Works(TM) out 
of the box for all possible creation states of your ref 
variables, you need to permute on all the ref parameters in your 
function. Which is either a process prone to human error; or in 
automated binding code, more things to parse at compile time 
resulting in slower compile times.


More information about the Digitalmars-d mailing list