On Thu, Nov 17, 2011 at 10:05 PM, Brendan Eich <bren...@mozilla.com> wrote:
> On Nov 17, 2011, at 9:04 AM, Allen Wirfs-Brock wrote: > > OK, I have a fix for the missing constructor problem. See: > http://wiki.ecmascript.org/doku.php?id=strawman:class_operator#missing_constructors > > > > Nit: [[ctor]], obviously a temporary hack-name. How about > [[ClassConstructor]]? or maybe [[DefaultConstructor]]? > > Non-nit: don't we want inherited 'constructor' to work, unless it has the > value Object? > For a chain Object <| Parent <| Child. We wouldn't want class Child to return Parent.constructor because then we would be creating new instances of Parent whenever we invoke new Child. We may want [[ctor]] that's generated on Child to invoke Parent.constructor as a default action rather then just be an empty function. This would involve changing > The value of this internal property is a new function object defined as if by function(){}. To The value of this internal property is a new function object defined as if by function(...args){ super.constructor(...args); }. Personally I think invoking the super constructor as default behaviour makes more sense. However we may want to optimise this so it only invokes the super constructor if the super constructor is not Object. [ credit to Axel ( https://gist.github.com/1374226 ) for default constructors invoking super.constructor ]
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss