Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

Frankie Bagnardi f.bagnardi at gmail.com
Sun Nov 16 18:34:01 PST 2014


Consider when Array.isArray would be used.  In my experience, checks to see
if something is an array are used for:

 - deciding how to iterate it (for(;;) vs for..in, for example)
 - deciding if the output should be an array or plain object (e.g. lodash)
 - early errors, e.g. runtime typecheck errors

In all of these situations, I don't care if it is an actual per-spec exact
array, I care if I can use it like an array.  That's how Array.isArray will
likely be used, and if it runs into problems, then expect github to be full
of 'don't use Array.isArray' patches on many libraries, much like the
existing instanceof situation.





On Sun, Nov 16, 2014 at 11:20 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 11/16/14, 2:12 AM, Brendan Eich wrote:
>
>> Are you confident this change is web-compatible?
>>
>
> No, I said that up-thread already.  So there may be nothing to worry about
> here spec-wise for now.
>
> -Boris
>
>
>
> _______________________________________________
> 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/20141116/395656f4/attachment.html>


More information about the es-discuss mailing list