@@new
Jason Orendorff
jason.orendorff at gmail.com
Tue Jun 17 17:03:46 PDT 2014
On Tue, Jun 17, 2014 at 6:55 PM, Erik Arvidsson
<erik.arvidsson at gmail.com> wrote:
> How does this work with legacy classes?
>
> function B() {
> this.x = 1;
> }
> class C extends B {}
That works!
`new C` desugars to `C[@@new]()`. C doesn't have a @@new method of
its own, so it inherits `Function.prototype[@@new]`.
The algorithm for that method is given in the proposal. Step 1 selects
the right prototype here (C.prototype), and step 4 calls B as desired.
-j
More information about the es-discuss
mailing list