Classes: suggestions for improvement

Brendan Eich brendan at mozilla.com
Tue Jun 14 18:34:55 PDT 2011


On Jun 13, 2011, at 10:07 PM, Peter Michaux wrote:

> On Mon, Jun 13, 2011 at 12:31 PM, Brendan Eich <brendan at mozilla.com> wrote:
> 
>> The language to emulate is Smalltalk, though.
> 
> +1 to that; however, the ES class proposal is not very similar to
> Smalltalk classes. Others are far more qualified to enumerate the
> differences than I am.

Smalltalk had instance-private instance variables, the classes proposal has class-private instance variables. That's a difference, but not fatal to the argument that Harmony classes are closer to Smalltalk than to other languages.

The other big difference you note below (class method inheritance) is still an open issue.

Reflection differs in its details, and Allen has blogged about mirror-based systems that go beyond what is in ES5. Whatever we do, Harmony class instances will be objects on which you can reflect using ES5's Object.getOwnPropertyNames, for the public properties, and so forth.


> For example, how can we do desugared class variable and method inheritance?

We are discussing class method inheritance still. I added it as an open issue.

Allen sent a reply today listing correspondences between Smalltalk class parts or sub-objects and Harmony class parts/sub-objects, which included "a class variable pool dictionary (roughly corresponding to any closure captured JS state that is shared by the constructor and instances)". Is that what you meant by "desugared class variable ... inheritance"?

Probably you should call out other differences you're concerned about, if any.

/be



More information about the es-discuss mailing list