destructuring: as patterns?

Brendan Eich brendan at
Wed Apr 18 13:49:00 PDT 2012

Herby Vojčík wrote:
> As was already pointed out, problems are not only _array_ 
> destructurings, but more argument list destructrings, where if you 
> want to destructure 0-th argument both as b and as {x,y}, you would 
> need something like that, since you already are inside list, you 
> cannot opt for object.

Why can't you use an object pattern? Array pattern is just shorthand for 
object pattern.

> (but if it is not the problem, I'd gladly see at least the object 
> double-destructure-same-field in ES6. It is not violating the "no 
> double property names" of strict mode since the assignment goes the 
> other way) 

Yes, Allen covered this five messages back in the thread. There's no 
problem because the set of bindings has no dups. Destructuring as dual 
of object or array literals threw me (even me, a big fan of duality -- 
but only briefly ;-).


More information about the es-discuss mailing list