The primary issue is that most array-likes aren't array-like when it comes
to mutability. Most exposed indexed objects don't allow changes to their
indices, which is decidedly un-array-like for ~quarter of array operations.
It would be useful for there to be a separate "Indexed" class/prototype
that contained the Array methods that don't mutate `this`, which Arguments
and NodeLists and a bunch of other stuff could inherit from, which would
also prevent backward compat issues with testing for instanceof Array.
On Sun, Dec 30, 2012 at 5:53 PM, Erik Arvidsson <erik.arvidsson at gmail.com>wrote:
> To clarify, my message was about making NodeLists have Array.prototype in
> its prototype chain.
> On Dec 30, 2012 5:50 PM, "Erik Arvidsson" <erik.arvidsson at gmail.com>
> wrote:
>>> The problem was code that incorrectly assumed instanceof to mean that the
>> instance was an Array in combination with Array.prototype.concat.
>>>> There was a bug in Google's Closure Library which caused almost all
>> Google's apps to fail due to this. The library was updated as soon as this
>> was found but there might still be code out there that makes the same
>> incorrect assumption in combination with concat.
>>>> I wanted to make another try under a runtime flag in Chromium but was
>> blocked by Apple.
>> On Dec 30, 2012 5:24 PM, "Domenic Denicola" <domenic at domenicdenicola.com>
>> wrote:
>>>>> > From: es-discuss-bounces at mozilla.org [mailto:
>>>es-discuss-bounces at mozilla.org] On Behalf Of Anne van Kesteren
>>> > Sent: Sunday, December 30, 2012 17:18
>>> >
>>> > On Sun, Dec 30, 2012 at 10:22 PM, Axel Rauschmayer <axel at rauschma.de>
>>> wrote:
>>> > > 5. Array-like objects [not completely fixed (DOM...), but `arguments`
>>> >
>>> > We've made some effort towards changing some of this, but legacy
>>> content is against us. :/
>>>>>> I saw this happen, and was sad, but never understood what the legacy
>>> problem was.
>>>>>> Similarly, when people ask me "why can't they just make arguments a real
>>> array" (perhaps with magic aliasing behavior in sloppy mode), I don't know
>>> the answer.
>>>>>> So just out of curiosity, how does legacy code break when making
>>> array-likes into real arrays? I feel like the Liskov Substitution Principle
>>> should have our back here.
>>> _______________________________________________
>>> es-discuss mailing list
>>>es-discuss at mozilla.org>>>https://mail.mozilla.org/listinfo/es-discuss>>>>>> _______________________________________________
> es-discuss mailing list
>es-discuss at mozilla.org>https://mail.mozilla.org/listinfo/es-discuss>>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121230/bf6a9414/attachment.html>