Why does legacy content break when making array-likes real arrays?

Erik Arvidsson erik.arvidsson at gmail.com
Sun Dec 30 14:53:21 PST 2012


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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121230/3a278008/attachment-0001.html>


More information about the es-discuss mailing list