Yigal Chripun wrote:
Stewart Gordon wrote:
Yigal Chripun wrote:
<snip>
a + 5, b + a //
<snip>
I don't follow you. What I said was that if you have the above in a for
loop with a comma expression, you'd expect to *first* add 5 to a and
*then* add the new a to b (comma operator defines left to right order of
evaluation).
<snip>
What "new a"? Normally, the expression "a + 5" doesn't alter the value
of a at all. The only time it would is if a is of a programmer-defined
type that has an opAdd function that does otherwise. Such semantics
bending is bound to create more confusion than the comma operator.
tuples in general do not have to require a specific order since you keep
all the results anyway, so the above could break. by defining tuples to
be evaluated with the same order, the problem would be solved.
Forcing an evaluation order on tuples would preclude common
subexpression optimisation.
Stewart.