assignment: left-to-right or right-to-left evaluation?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat May 9 10:52:27 PDT 2009


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 also searched for the way Perl does it and got a tad disappointed:

http://www.nntp.perl.org/group/perl.perl5.porters/2003/09/msg82032.html

Essentially the order of evaluation in Perl is as arbitrary and as 
specific-case-driven as if nobody really sat down and thought any of it.


Andrei



More information about the Digitalmars-d mailing list