Minimalist Classes

Quildreen Motta quildreen at
Tue Nov 1 19:17:22 PDT 2011

On 02/11/11 00:01, Brendan Eich wrote:
> 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".
Fair enough.

>> 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.
> /be
Hm, I don't think `lhs = rhs' suggests any more of a non-declarative 
form than `var'. Taking JS semantics into consideration, I'd say `var' 
is more misleading (whereas `lhs = rhs' just feels weird).

There's `public', but then, that's quite verbose. I guess people comming 
from a classical language with declarative definitions for class slots 
might still be used to it, none the less.

More information about the es-discuss mailing list