assignment: left-to-right or right-to-left evaluation?
Frank Benoit
keinfarbton at googlemail.com
Sat May 9 13:51:21 PDT 2009
Andrei Alexandrescu schrieb:
> Frank Benoit wrote:
>> From my POV, it would be nice if it would be the same as in Java,
>> because i am porting lots of it to D.
>
> Good point. I searched for that one and found:
>
> http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html
>
> "The Java programming language guarantees that the operands of operators
> appear to be evaluated in a specific evaluation order, namely, from left
> to right."
I think, code relying on the order is bad code. And iI think there is no
"right" way.
But...
+ it is good to have it defined
+ it is good if ported code will not break because of that difference
I see no other argument. So the question would be, from which language
would you expect the most ported code?
I think it will be C/C++ bindings for libs and Java code
For bindings/declarations the evaluation order is not of relevance. So
choose Java's scheme. :)
More information about the Digitalmars-d
mailing list