An array destructing specification choice

Axel Rauschmayer axel at rauschma.de
Sun Nov 6 10:27:00 PST 2011


>> 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.


One would have to rethink all of these issues if the namespaces of array indices and of property names became disjoint in the future. But it’s just an edge case, anyway.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111106/cf304d1f/attachment-0001.html>


More information about the es-discuss mailing list