es-discuss Digest, Vol 52, Issue 161
brendan at mozilla.com
Tue Jun 28 17:17:57 PDT 2011
On Jun 28, 2011, at 4:22 PM, Axel Rauschmayer wrote:
>> Plus, the prototype is in some ways secondary. It's the less directly used object when one calls a constructor often, after populating the prototype. And if class methods come into the picture, the prototype is even more "backstage", an implementation detail.
> What do you do with constructors-as-classes to check the following?
> o instanceof C
> You look for C.prototype in the prototype chain of o.
No, the JS engine does that!
I, or random classy-dynamic-language-experienced users, just do "o instanceof C", i.e., they ask "is o an instance of [constructed by] C"?
Not everyone mentally deconstructs operators into their more primitive semantics. Especially if there's no prototype-chain hacking, just shallow classical inheritance via a solid library.
More information about the es-discuss