On Aug 21, 2008, at 8:23 PM, David-Sarah Hopwood wrote: > Brendan Eich wrote: >> On Aug 21, 2008, at 6:47 PM, Mark S. Miller wrote: >>> On Thu, Aug 21, 2008 at 6:34 PM, Brendan Eich <[EMAIL PROTECTED]> >>> wrote: >>>> js> [d,e,f] = foo() >>>> 1,2,3 >>> Is this a simultaneous assignment of d,e,f, or does it declare >>> variables d,e,f? >> >> The first. >> >>> If the first, can you do a swap as >>> >>> [d, e] = [e, d] >> >> Sure can (variable values as in previous mail): [...] > > So the rule is that the RHS is evaluated, and then the assignments are > done left-to-right, correct? And each array element (or property value > in the case of an object literal) on the left is syntactically a > LeftHandSideExpression?
Yes. In the binding forms, each element must be an identifier. > (Sounds fine, I just want to confirm my understanding.) http://wiki.ecmascript.org/doku.php? id=proposals:destructuring_assignment http://wiki.ecmascript.org/doku.php? id=discussion:destructuring_assignment /be _______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

