new instantiation design alternatives

Boris Zbarsky bzbarsky at mit.edu
Thu Sep 18 09:57:05 PDT 2014


On 9/18/14, 12:51 PM, Andreas Rossberg wrote:
> Well, nothing has to go there. Since B does not have an extends
> clause, it has -- according to Allen's gist -- its `this` initialized
> implicitly (with an object having the derived constructor's prototype,
> like you want).

Wait.  How does the |new super()| invocation know what prototype to use, 
exactly?  Is it basically passing in the new^ value as some sort of 
hidden state under the hood without exposing it with a name?

> What new^ adds to the table is the ability to bypass this mechanism
> and implement non-standard inheritance or creation patterns within the
> class syntax.

Well, it adds the ability to explain what happens when you do:


    class A extends HTMLElement {
       ...
    }

right?

-Boris


More information about the es-discuss mailing list