Type inference and overloaded functions

bearophile bearophileHUGS at lycos.com
Wed Dec 11 17:17:57 PST 2013


Namespace:

> Your gig: 
> https://github.com/D-Programming-Language/dmd/pull/2952#discussion_r8288045

My enhancement request was for the array[$] syntax. The idea of 
[]s was invented by someone else (Timothee Cour?).

I like the practical comments by Hara. If Kenji thinks the []s is 
not useful for efficiency (because the efficiency can be obtained 
with just improvements of the compiler), then the []s syntax 
becomes less necessary.


On the other hand this is an interesting use case that compiler 
improvements alone could not be enough to allow:

void fun(int[3]) {}
void main() {
     int[3] x = [1, 2, 3];
     fun(x); // OK
     fun([1, 2, 3]); // error
     fun([1, 2, 3]s); // OK
}


Are vector ops supported?

int[6] a;
a = [1,2,3]s[] + [4,5,6]s[];

DIP34 is still a draft, and it shows, some corner cases are 
missing in that document and need to be found, fleshed out and 
added to the DIP34.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list