new instantiation design alternatives

Rick Waldron waldron.rick at gmail.com
Sun Sep 14 17:27:07 PDT 2014


On Sun, Sep 14, 2014 at 7:23 PM, Brendan Eich <brendan at mozilla.org> wrote:

> 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`).
>
> /be



As a follow up to these comments re: `this = new super(x, y);`, I couldn't
find anything in this thread or the gists that discussed how, if at all,
`super` syntax or semantics will change in method bodies.

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140914/fb0f640b/attachment.html>


More information about the es-discuss mailing list