Summary: prototypes as classes (PaCs)

Axel Rauschmayer axel at rauschma.de
Tue Jun 28 17:30:30 PDT 2011


>> 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.

But with PaCs you don’t have to deconstruct, there is no detour from the class to another construct.

> Especially if there's no prototype-chain hacking, just shallow classical inheritance via a solid library.


Then we would have a Python-like abstraction on top of current facilities. Which I don’t mind at all. But I’m worried about the abstraction leaking.

If prototypes already make it all work in the background, why not try and make do just with them?

-- 
Dr. Axel Rauschmayer

axel at rauschma.de
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com





More information about the es-discuss mailing list