Inconsistent evaluation order in destructuring assignments
be5invis at outlook.com
Fri Oct 18 12:24:34 PDT 2013
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 value via evaluating RHSparse LHS patternbring parts of RHS into the LHS subpatterns
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss