In the D spec, the function parameter section on order of evaluation says:
>Arguments are evaluated left to right.
So a question was raised, what about named arguments, since those might not match the order of parameters?
I decided to test:
import std.stdio;
void foo(int a, int b) {
writeln(i"a: $(a), b: $(b)");
}
void main() {
int x;
foo(b: ++x, a: ++x);
}
According to the spec, this should print "a: 2, b: 1", as the order of evaluation of the expression should go left to right. But the actual printout is "a: 1, b: 2".
So the question is, should we modify the spec to reflect this, or would it be better to change the compiler to enforce this left-to-right evaluation rule?
-Steve