> 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): http://www.python.org/download/releases/2.2.3/descrintro/ 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 a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss