Classes: suggestions for improvement

Brendan Eich brendan at
Mon Jun 13 10:50:26 PDT 2011

On Jun 13, 2011, at 10:33 AM, Kam kasravi wrote:

> On Jun 12, 2011, at 10:49 PM, Brendan Eich <brendan at> wrote:
>> On Jun 12, 2011, at 8:46 PM, Axel Rauschmayer wrote:
>>> I’ve only got one use case for this, but “class methods” would also work better if they could be attached to the prototype (and subject to inheritance) instead of the constructor.
>> We had a thread about this, because Ruby and CoffeeScript (which translates to JS and copies properties to do "constructor inheritance") both support class method inheritance.
>> Putting class methods on the prototype mixes up is-a relations, making the class constructor delegate to the class prototype. That breaks constructor is-a function in general. Better to have two parallel proto-chains, one from subclass prototype to superclass prototype, the other from subclass constructor to superclass constructor.
> Is the constructor calling implicit if not specified? For example both c++ and java will call super() implicitly if there is no explicit call for the subtype constructor.

You're asking a question about something completely different. Whether class methods are inherited has no bearing on super call automation.

The classes proposal does not automate super calling. It's best for the user to be explicit. Guessing and passing no actual arguments is like to go wrong. JS has memory safety so the problem caused by a missing super-constructor call is a runtime value error.


More information about the es-discuss mailing list