Minimalist Classes

Brendan Eich brendan at
Tue Nov 1 19:01:49 PDT 2011

On Nov 1, 2011, at 6:57 PM, Quildreen Motta wrote:

> I like how clean the syntax is there, Brendan. I still feel class syntax would have more value if they presented a nice way for object composition besides inheritance.

Traits were factored out and I consider adding them in this exercise to be a "bridge too far".

> None the less, I think we could well get rid of those `var' inside the class-body, as long as it's not executable:

I don't think so, although Bob Nystrom's suggestions ended up simplified that way. It's awkward to use assignment expression as a declarative form. It suggests the body *is* executable. Instead, I went with 'var' as Bob did originally.

My view is that 'var' will die hard and for global-object-aliasing global variables, it's close to class prototype properties. There's no way to observe the prototype half-initialized. As noted, there's a risk people will think methods close over proto-vars/consts.


More information about the es-discuss mailing list