Replacing the comma operator
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Jul 28 16:55:43 PDT 2009
Stewart Gordon wrote:
> Jarrett Billingsley wrote:
> <snip>
>> For two, what problem did Andrei point out? Order of evaluation of
>> function arguments? On the contrary, he said "now that order of
>> evaluation will be defined to be left-to-right in D, the semantics
>> would be quite the same". Your code is what you'd have to use in D1,
>> but in D2, the simpler version would suffice.
>
> What do you understand by the combination of "now" and "will be"?
>
> I understood that he was speaking either sarcastically or hypothetically.
>
> Or can you find any official statement of this change, let alone a
> rationale for it?
No, sorry. Usually I strive to be precise, but this time I just wasn't.
The plan is to define order of evaluation to be lexical order. Somehow I
can't convince Walter that that means assignment too!
e1[e2] = e3;
means:
1. Evaluate e1
2. Evaluate e2
3. Evaluate []
4. Evaluate e3
5. Evaluate assignment.
Walter wants:
1. Evaluate e3. Why in the world, I have no idea.
2, 3. Evaluate e1 and e2, I'm not sure in which order he thinks is right
4. Evaluate []
4. Evaluate =
Lexical order rules. Lexical order dammit!
Walter and I see eye to eye probably 95% of the time, which has two
disadvantages: (a) everybody here thinks one is influencing the other
when in fact most of the time we arrive at the same conclusion from very
different paths, (b) the remaining 5% are disconcerting. This is one of
those cases.
Andrei
More information about the Digitalmars-d
mailing list