this is almost a workaround for the lack of named parameters

Jacob Carlborg doob at me.com
Sun Mar 24 13:36:14 PDT 2013


On 2013-03-24 20:59, timotheecour wrote:
>> BTW, why was the constructor added to Proxy and the "dummy" argument?
>
> because I wanted to simplify syntax from 'auto
> ret2=named!fun.z(3).x(4).call();' to 'auto
> ret2=named!fun.z(3).x(4)();'
> In doing that, I was having CT errors without it due to ambiguity
> between default unnamed constructor and opCall, so I added
> constructor.
> Then inside the named() function i needed to return a proxy object.
> Alternatives were:
> return Proxy!(func, null)(); //wrong: would call opCall
> return Proxy!(func, null).init; //not sure if it would incur overhead
> return Proxy!(func, null)(0); //introduces dummy arg, which should be
> optimized away.

Aha, ok I see.


> Finally, how do I reply from my email client ? Right I'm using
> http://forum.dlang.org/ otherwise the message isn't delivered on the
> forum... Thanks!

I'm using Thunderbird and just using "Reply to the message".

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list