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.

If you can find a better way (that doesn't incur runtime overhead),
please do a pull request!
Also, I'm wondering about:
* how to put the unittest helper function "fun" inside main unittest block
* whether the named!fun.z(3).x(4)(); call has any overhead over
calling fun(4,2,3) directly.
* how to support templated functions (here fun is not templated)
* whether we should support this syntax:
auto ret=named!fun.z(3)(4); //this would mean named!fun.z(3).x(4)();
ie all non-optional arguments go in the opCall(..) arguments, all
optional arguments are called by name. So that would force API to
freeze names only for optional arguments, not non-optional ones, cf in
python:
fun(4,z:3)


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!

Reply via email to