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

Brandon Benvie brandon at brandonbenvie.com
Mon Dec 31 10:39:08 PST 2012

True, concat specifically needs to be changed. But it is the only Array
method that does that check (the only other internal checks
for brand BuiltinArray are in apply and isArray I think).

On Mon, Dec 31, 2012 at 1:33 PM, Erik Arvidsson <erik.arvidsson at gmail.com>wrote:

> On Sun, Dec 30, 2012 at 6:05 PM, Brandon Benvie
> <brandon at brandonbenvie.com> wrote:
> > 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.
> The issue is not about the mutation methods even though it is non
> sensical to call push on an immutable array.
> > 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.
> That would not help in the case with NodeList. The fix there would be
> to have concat not do a brand check on its arguments. Allen has
> outlined the problematic brand checks at
> http://wiki.ecmascript.org/doku.php?id=strawman:es5_internal_nominal_typing
> --
> erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121231/4fe66d76/attachment-0001.html>

More information about the es-discuss mailing list