Why does legacy content break when making array-likes real arrays?
erik.arvidsson at gmail.com
Mon Dec 31 10:33:28 PST 2012
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
More information about the es-discuss