ES6 classes: deferring the creation step
claude.pache at gmail.com
Sat Jun 28 15:18:26 PDT 2014
> Le 28 juin 2014 à 17:49, Brendan Eich <brendan at mozilla.org> a écrit :
> I like it! Cc'ing others who may have missed it. Boris is DOM guru you seek.
> Does it address the bound function issue you cited in the previous thread? It appears not to, but I might be missing something (jetlag).
It does address the issue (if my reasoning is correct).
Rethinking on the subject, I think that the intended semantics would have appeared more clearly, if I had kept a modified [[Construct]] internal method separate from the [[Call]] one. Then, the `new` operator would invoke [[Construct]], but, more notably, `super` would also invoke [[Construct]] when the this-binding is not yet initialised (i.e., when `this` is a Non-Constructed Object). — `super` invocations occurring when `this` is initialised regularly invoke [[Call]].
So, roughly, the first `super` in a constructor would invoke the super-constructor with the semantics of a constructor rather than of a method. Therefore, subclassing objects with even wildly different [[Construct]] and [[Call]] behaviours would just work.
Also, the @@new hook would just have been an exact override of the modified [[Construct]] internal method. (Which is another reason why I should have kept [[Construct]] and [[Call]] separate.)
More information about the es-discuss