Class literals: does "public" still make sense?

Axel Rauschmayer axel at rauschma.de
Sun Sep 25 14:20:40 PDT 2011


> We did not agree to drop the private declaration syntax at the July TC39 meeting. Perhaps my understanding of our agreement then does not match Marks?
> 
> What we agreed to drop was the private(this) straw syntax in the classes proposal, in favor of this[x], this[y], for private-declared private name objects x and y.

For public properties one has two options:
1) this.foo = foo;
2) public foo = foo;

Using Mark’s terminology, #1 is imperative, #2 is declarative.

Private properties would be declared like this (right?)
this[myPrivateName] = someData;

This is imperative (like #1), there is no way to do this declaratively (like #2).

I think it’s a clean solution and am not sure how much private properties are needed for non-security-critical applications. But it does not give you the automatic “const-ification” of “public”.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
twitter.com/rauschma

Home: rauschma.de
Blog: 2ality.com



More information about the es-discuss mailing list