digitalmars.D - Eval order, bug or design decision?
- Frank Benoit (8/8) Mar 08 2008 int[] a1, a2;
- Jarrett Billingsley (5/13) Mar 08 2008 http://www.digitalmars.com/d/1.0/expression.html
- Walter Bright (3/14) Mar 08 2008 Currently order of evaluation dependencies are illegal in D. Did you run...
- Frank Benoit (4/9) Mar 08 2008 Yes, see 2. + 3. change
- Walter Bright (3/11) Mar 08 2008 My old C eyes are pretty sensitive to that, too. But it's also clear
int[] a1, a2; // .... int idx = 0; a1[idx] = a2[idx++]; In Java this has another result like in D. Java will evaluate from left to right, D does the increment befor doing the assignment, so the copied values go into different fields. Is this a bug or design decision?
Mar 08 2008
"Frank Benoit" <keinfarbton googlemail.com> wrote in message news:fqubu4$2d2e$1 digitalmars.com...int[] a1, a2; // .... int idx = 0; a1[idx] = a2[idx++]; In Java this has another result like in D. Java will evaluate from left to right, D does the increment befor doing the assignment, so the copied values go into different fields. Is this a bug or design decision?http://www.digitalmars.com/d/1.0/expression.html Very first section. It's illegal code but it's up to the compiler to detect it or not. I guess you could file a bug about it as "accepts-invalid".
Mar 08 2008
Frank Benoit wrote:int[] a1, a2; // .... int idx = 0; a1[idx] = a2[idx++]; In Java this has another result like in D. Java will evaluate from left to right, D does the increment befor doing the assignment, so the copied values go into different fields. Is this a bug or design decision?Currently order of evaluation dependencies are illegal in D. Did you run across it in some Java code?
Mar 08 2008
Walter Bright schrieb:Frank Benoit wrote:Yes, see 2. + 3. change http://www.dsource.org/projects/dwt-linux/changeset/204%3A8ab2f71515ba My eyes will be more sensible for this patterns now :)Is this a bug or design decision?Currently order of evaluation dependencies are illegal in D. Did you run across it in some Java code?
Mar 08 2008
Frank Benoit wrote:Walter Bright schrieb:My old C eyes are pretty sensitive to that, too. But it's also clear that D should move to a defined left-to-right order-of-evaluation semantic.Currently order of evaluation dependencies are illegal in D. Did you run across it in some Java code?Yes, see 2. + 3. change http://www.dsource.org/projects/dwt-linux/changeset/204%3A8ab2f71515ba My eyes will be more sensible for this patterns now :)
Mar 08 2008