motivating <| as structure representation, not operator

Axel Rauschmayer axel at
Sat Nov 19 08:42:24 PST 2011

> Constructors are really the only confusing thing in JavaScript's prototypical
> implementation. The way I usually explain it is by first talking about
> `[[Prototype]]' and the under-the-hood semantics using objects alone,
> then explaining how constructors mess all that up :3

Exactly! I find it sad that people think that prototypal inheritance is complicated, but it is actually constructors that are complicated (as they are used in ES5).

> The special-casing of `new' has been my "favourite" topic so far.
> That said, I find it interesting to think about <| in terms of structural
> notation rather than yet another complex layer on top of constructors.
> In fact, I'd rather give up on constructors entirely, but I don't think
> that's an option now =/

I understand the aversion to introducing a new approach to inheritance. However, Python has managed well when it introduced new-style classes (I don’t recall any public outrage, Python 3 is much more controversial):

Probably less radical than going from function exemplars to object exemplars, but there are many similarities. I haven’t found a “lessons learned” document, though.

I can even imagine class declarations being used as syntactic sugar for object exemplars.

Dr. Axel Rauschmayer
axel at


More information about the es-discuss mailing list