On Nov 17, 2011, at 2:05 PM, Brendan Eich 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?

let BasicPoint = class {x:0, y:0, constructor() {}};
let BetterPoint = class BasicPoint <| {better: true};
let bp = new BetterPoint;
print(bp.better ? "wrong: bp [[Prototype]] is BasicPoint. prototype" :  
"correct: bp [[Prototype]] is BetterPoint.prototype");

BetterPoint needs a [[DefaultConstructor]] for the same reason that the 
original Point example does. 

We can debate whether Default Constructors should do a:
    if (super.constructor isnt Object) super.constructor()
but that is a more basic question about whether constructors (default or 
otherwise) should always do implicit super calls.

Allen 



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to