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

Allen Wirfs-Brock allen at
Fri Nov 14 09:11:53 PST 2014

On Nov 14, 2014, at 4:53 AM, Domenic Denicola wrote:

> From: es-discuss [mailto:es-discuss-bounces at] On Behalf Of Tom Van Cutsem
>> Is the `length` invariant really the dominant meaning JS developers attribute to Array.isArray? I think to most developers Array.isArray(obj) returning true means that it's safe to call the array utilities (map, forEach, ...) on obj, not so much that obj.length is special.
> This is really interesting. It does argue for some kind of redefinition of Array.isArray to return "is this an instance of some %ArrayPrototype% in some realm?" That is very close to "does the object have an @@isConcatSpreadable" property, the main difference being that you can "fake" the latter via `myObj[Symbol.isConcatSpreadable] = true` while still not inheriting from any %ArrayPrototype%.

What do you mean by "is an instance of some %ArrayPrototype%"? Do you mean that it has some %ArratPrototype% in it's prototype chain?  This is actually fairly hard to determine.  We look at trying to identify known prototypes independent of realm  for an earlier issue and rejected the possibility because it would require additional tragging of such prototypes.  Also, it wasn't clear who the concept could be extended to JS defined classes.


More information about the es-discuss mailing list