Combining typeof and instanceof
andrea.giammarchi at gmail.com
Sun Feb 3 15:09:59 PST 2013
you should link "Have you met Empty?" entry there:
It explains why typeof null is object, and provides more insights about the
Empty constructor and the root of JS inheritance.
Said that, the difference between is_type, is_a (is_instance), and
responds_to(BehaviorObject) from Ruby, is kinda important. Back to good old
cross frame problem when an Array.prototype could be polluted in frame-x
but not on top, isInstance(arrayFromFrame, Array) will fail there and this
is both expected behavior, and correct, IMHO.
Any attempt to clarify type and instances will result in more confusion,
same confusion has TypeScript between val:string and val:String, either
there is a rule about checking the class name or its symbol with an
operator or something will be ambiguous anyhow.
My 2 cents
On Sun, Feb 3, 2013 at 1:14 PM, Axel Rauschmayer <axel at rauschma.de> wrote:
> It has always bothered me that one had to distinguish primitives and
> a proposal for changing that:
> Comments and suggestions welcome.
> Dr. Axel Rauschmayer
> axel at rauschma.de
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss