Classes: suggestions for improvement

Kam kasravi kamkasravi at yahoo.com
Mon Jun 13 10:33:29 PDT 2011



On Jun 12, 2011, at 10:49 PM, Brendan Eich <brendan at mozilla.com> 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.

> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list