Re: Inconsistent evaluation order in destructuring assignments

2013-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2013, at 12:24 PM, BelleveInvis wrote: > ...this causes an inconsistency that in expression `[f().x] = [g()]`, g is > called BEFORE f. That is weird, and differ from `f().x = g()` where g is > called after f. but consider [f().x, h().y] = g(); //assume g() evaluates to an array-

Re: Inconsistent evaluation order in destructuring assignments

2013-10-18 Thread Brendan Eich
Yes, this is intentional and goes all the way back to ES4's original destructuring proposal, based on array-pattern destructuring implemented in Opera's Futhark engine. See http://wiki.ecmascript.org/doku.php?id=discussion:destructuring_assignment#contrast_to_normal_assignment We want destructuri

Inconsistent evaluation order in destructuring assignments

2013-10-18 Thread BelleveInvis
In ES5 all assignments are evaluated following this formula: get a reference via evaluating LHSget a value through evaluating RHSassign the value to the reference However in the current draft, destructuring assignment are evaluated in another order which is (as seen in section 12.13.3) get a valu