Pretty please: Named arguments

Jim bitcirkel at yahoo.com
Mon Feb 28 12:44:20 PST 2011


Bekenn Wrote:

> On 2/28/11 5:48 AM, Andrei Alexandrescu wrote:
> > One more thing, order of evaluation should still be left-to-right, not
> > in order of arguments. This means the feature cannot be a syntactic
> > rewrite (not a big issue, but definitely something to keep in mind).
> >
> >
> > Andrei
> 
> I was thinking that order of evaluation should remain lexically 
> left-to-right at the point of call (that is, in the order the arguments 
> are specified, with any remaining default parameters coming after); is 
> there a reason that would be bad or wouldn't work?


No, the called function could be from a linked library, for all we know. Reordering the evaluation of the arguments would not have any effect on the function itself.

Left-to-right evaluation at the point of call would concur with the Principle of Least Astonishment:


void fun(int foo, int bar);

int moo(); // might have side-effects!

fun(bar:moo(), foo:moo());



More information about the Digitalmars-d mailing list