Strawman proposal: new `is` operator
till at tillschneidereit.net
Tue Aug 26 05:18:20 PDT 2014
On Tue, Aug 26, 2014 at 3:56 AM, Brendan Eich <brendan at mozilla.org> wrote:
> ES4 had 'is' as a type-classifying operator:
> It would be a mistake to define 'is' without defining the (unsound) type
> system it depends on. This is a challenge, but TypeScript and other
> close-to-ES6 languages have sallied forth. We need a detailed proposal.
Though TypeScript cannot support an `is` operator because it only has duck
typing/structural types. Which makes sense for the web, I think, given that
lots of code has to interact across realms, and staticly-checked types with
their inherent anti-modularity are a problem for that. AS3 (which
implements ES4's `is` operator) has the same issue across Flash's
Note that ES6's formulation of `instanceof` in terms of an optional
`@@hasInstance` trap can, in combination with the cross-realm symbol
registry, probably be used to implement the desired behavior, even across
realms. For non-primitives, at least.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss