destructuring: as patterns?

Brendan Eich brendan at
Wed Apr 18 13:38:58 PDT 2012

Allen Wirfs-Brock wrote:
>> For array patterns we would need to allow property assignments in array literals:
>> >  
>> >    let [b, 0:{x,y}] = ...;
>> >  
>> >  This was proposed at one point, IIRC, but a while ago.

Of course, one could destructure like so:

   let {0: b, 0: {x, y}} = ...;

> It was also suggested that we allow iterators/generators to supply the  initialization values to array destructurings.  This currently isn't in the draft spec. and I think it would introduce some fairly significant specification and practical complications (eg, rest bindings and open-ended generators).

Destructuring patterns should be static. I don't see a conflict if we 
stick to this rule, but given the ability to use an object pattern, I 
don't see a need for the array literal element label syntax either.


More information about the es-discuss mailing list