primitive boxing in instanceof due to Symbol.hasInstance

Kevin Smith zenparsing at gmail.com
Mon Jun 15 17:20:27 UTC 2015


>
>
> https://people.mozilla.org/~jorendorff/es6-draft.html#sec-instanceofoperator
> calls GetMethod on C without checking if it is an Object, this means `1
> instanceof Foo` could be affected by mutating
> `Number.prototype[Symbol.hasInstance]`.
>

I assume you mean "without checking if O is an object"


> I am assuming this is unintended?
>

IIUC the point of @@hasInstance is to allow the programmer to define
completely arbitrary semantics for "instanceof" when applied to "C", even
if C is a built-in.  Do you see a problem with this behavior?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150615/2cac20cd/attachment.html>


More information about the es-discuss mailing list