Infer function template parameters

Timon Gehr timon.gehr at gmx.ch
Thu Sep 20 13:58:21 PDT 2012


On 09/20/2012 09:57 PM, Jonas Drewsen wrote:
> ...
> What am I missing (except some code that needs chaging because only
> param type and not name has been specified in [i]t?
>

Nothing, that is about it. (C backwards-compatibility could maybe be
added) Of course, we could make upper case identifiers indicate
parameters without name and lower case identifiers indicate parameters
with templated types, keeping the breakages at a minimum. :o)

Note that other language changes would have to be made, eg:

void main(){
     int delegate(int) dg1 = x=>x; // currently ok, should stay ok
     auto foo(T)(T x){ return x; }
     int delegate(int) dg2 = &foo; // currently error, would become ok
}

(x=>x would become a template delegate literal following your proposal)


More information about the Digitalmars-d mailing list