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

Tom Van Cutsem tomvc.be at gmail.com
Wed Nov 12 23:22:30 PST 2014


2014-11-12 20:53 GMT+01:00 Rick Waldron <waldron.rick at gmail.com>:

>
> Done https://github.com/tc39/agendas/blob/master/2014/11.md
>

Thanks. A related point: my harmony-reflect shim also patches
Array.prototype.concat such that it recognizes proxies-for-arrays and will
splice their elements (rather than adding the proxy as a single element to
the target array).

In ES6, this may not be necessary since a proxy could implement
@@isConcatSpreadable (see <
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.prototype.concat>
step 9.b)

However, looking at IsConcatSpreadable <
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconcatspreadable>
step 5, you'll notice it explicitly tests for Arrays. *If* we decide that
Array.isArray should return `true` for proxies-for-arrays, *then* I think
we should relax this step 5 to also return `true` for proxies-for-arrays,
on the grounds of consistency and principle-of-least-surprise.

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141113/51d460a0/attachment.html>


More information about the es-discuss mailing list