new instantiation design alternatives

Brendan Eich brendan at
Tue Sep 16 16:55:03 PDT 2014

[Snipped text that talks mostly about what but not why.]

Allen Wirfs-Brock wrote:
> But as you say, the real issue we are trying to address now is eliminating exposure of uninitialized non-ordinary objects and support for  constructors called as functions.  I think we're on a good path to solve those.

Could be!

>   Unfortunately, I think the super in function header discussion is mostly a distraction and not really helping focus the discussion on  the core issues.

It is an attempt to address the "uninitialized" problem, but I hear your 
concern that it is too restrictive (re: before/around `super` advice).

It would help, I think, if you replied to Kevin's mail dated 12:05pm 
yesterday, which ended:

Well, what I'm trying to point out is that it's always an error to set 
"this" if "new^" is undefined.  So it's kind of strange to force the 
user to explicitly write that conditional:

     constructor(x, y) {
         if (new^)
             this = new super(x);
         this.y = y;

With the header approach, it's taken care of:

     constructor(x, y) : super(x) {
         this.y = y;

(using colon just to avoid bikeshedding)


More information about the es-discuss mailing list