An array destructing specification choice

Allen Wirfs-Brock allen at
Sun Nov 6 10:20:40 PST 2011

On Nov 6, 2011, at 10:01 AM, Axel Rauschmayer wrote:

>>> ...
> Very interesting. Still seems orthogonal to the decision whether or not to coerce the rhs to array (whatever that means). If []= is considered an “array operator” then coercion seems in line with how other operators behave.
> If I wanted to ignore the length property, I would use:
>      let { 0: a, 1: b } = someValue

This is pretty much my thinking too.  A programmer's choice to use  [ ]  instead of {} the destructuring pattern means something. By choosing to use [ ] as the pattern they are expressing the intent to view someValue using "array element" access semantics. If they don't care about such things, they can use the { } pattern.


More information about the es-discuss mailing list