destructuring: as patterns?

Brendan Eich brendan at
Wed Apr 18 09:32:36 PDT 2012

Irakli Gozalishvili wrote:
> OMG, you're right!!! I could swear it did not worked before as I had 
> unsuccessful attempts to use that form. I guess it's ok if Brendan did 
> not knew it either :D

I never said I didn't know, I said ES6 new syntax opts into strict mode 
for things like banning duplicate property names in object literals, so 
this might well apply to duplicate property names in object patterns. I 
still think this may be the case.

ES4-era destructuring was very shallow sugar:

var {x: y} = z; => var y = z.x;

and so on -- with a temporary to avoid evaluating z more than once, and 
z is evaluated first (a left-to-right evaluation order break, but others 
exist, e.g. for-in loop head evaluation order).


More information about the es-discuss mailing list