new instantiation design alternatives

Brendan Eich brendan at
Sun Sep 14 16:23:23 PDT 2014

Kevin Smith wrote:
>  If we want to merge allocation with initialization, then I'm going to 
> want to invoke C# (yet again):
>     class ColoredPoint extends Point {
>         constructor(x, y, color) : super(x, y) {
>            this.color = color;
>         }
>     }

Gotta credt C#'s parents, C++, which would require Point not super.

I think you are really onto something here. We do not want anything 
looking like an expression-statement in the constructor body, which 
besides being verbose has unwanted degrees of freedom (requiring TDZ for 
`this`, running into the dead code problem Jeff cited, etc.).

It sure seems to me that we rather want a special form in the 
constructor head. This came up in ES4.

Separately I agree `this = new super(x, y);` is just crazy long and very 
likely to be left out in whole or in part (the `new`).


More information about the es-discuss mailing list