I noted some open issues on "Classes with Trait Composition"

Gavin Barraclough barraclough at apple.com
Tue Jun 7 13:18:55 PDT 2011

Cheers Brendan.  I must say, I really like how the class sugar is coming together.  It seems that more closely matching a familiar syntax might make things a little more approachable for existing OO programmers, but I certainly see the elegance in using "constructor" directly.


On Jun 7, 2011, at 12:57 PM, Brendan Eich wrote:

> I'm not sure -- I wasn't in on the earlier design sessions among the champions. I know "new" was used, but if we are sugaring prototypal inheritance, we need something to create "constructor" in the prototype (which is where method definitions written directly in the class body bind their names).
> Having some backstage magic wire up "constructor" is possible but then you have two names for the constructor. That is a wart.
> The bigger issue is that doing this preempts use of "new" as a prototype property name (allowed by ES5).
> So to keep things simple, express the prototypal machinery already in the language directly and explicitly, and avoid preempting "new", we've settled on "constructor".
> The bigger issues with classes to close down include private instance variable syntax and semantics, and static method s&s. Some followup work is already under way here. We need to get this solid by the July TC39 meeting.
> /be

More information about the es-discuss mailing list