Array.isArray(new Proxy([], {})) should be false (Bug 1096753)
Andrea Giammarchi
andrea.giammarchi at gmail.com
Wed Nov 12 14:49:34 PST 2014
If Array.isArray should fail for non "pure" Arrays, can we have a
Proxy.isProxy that never fails with proxies ?
At least this would give a better idea on what's eventually going on:
```js
if (Array.isArray(obj) && !Proxy.isProxy(obj)) {
// ... ok, pure Array, no magic wrappers
}
```
Regards
On Wed, Nov 12, 2014 at 6:47 PM, David Bruant <bruant.d at gmail.com> wrote:
> Le 12/11/2014 17:23, Tom Van Cutsem a écrit :
>
> I agree with your sentiment. I have previously advocated that
> Array.isArray should be transparent for proxies. My harmony-reflect shim
> explicitly differs from the spec on this point because people using the
> shim spontaneously reported this as the expected behaviour and thought it
> was a bug that Array.isArray didn't work transparently on proxies.
>
> For reference https://github.com/tvcutsem/harmony-reflect/issues/13
>
> As far as I can remember, the argument against making Array.isArray
> transparent is that it's ad hoc and doesn't generalize to other types /
> type tests. My opinion is that array testing is fundamental to core JS and
> is worth the exception.
>
> Agreed. Author usability should trump language purity.
>
> David
>
>
> Regards,
> Tom
>
> 2014-11-12 17:04 GMT+01:00 Axel Rauschmayer <axel at rauschma.de>:
>
>> The subject is a SpiderMonkey bug.
>>
>> Is that really desirable? Doesn’t it invalidate the Proxy’s role as an
>> interceptor?
>>
>> --
>> Dr. Axel Rauschmayer
>> axel at rauschma.de
>> rauschma.de
>>
>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
>
> _______________________________________________
> es-discuss mailing listes-discuss at mozilla.orghttps://mail.mozilla.org/listinfo/es-discuss
>
>
>
> _______________________________________________
> 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/20141112/937cc930/attachment.html>
More information about the es-discuss
mailing list