do we have a thisclass? (for abstract static methods)

Allen Wirfs-Brock allen at wirfs-brock.com
Fri Jun 7 08:53:47 PDT 2013


On Jun 7, 2013, at 8:50 AM, Claus Reinke wrote:

>>> We do have this/super for references along the instance prototype
>>> chain, and we have this.constructor for getting to the class of an instance
>>> method. But what about getting the current class from a static method,
>>> for class-side inheritance?
>>> 
>>> Can't you just use "this"?
>> 
>> Exactly, that should work. The constructors form their own prototype chain (somewhat independently of the instance prototypes, but reflecting their chain), so everything should work out. In other words, Sub is just an object, so its methods can use `this` to refer to each other.
> 
> Kind of obvious from the desugaring... My thinking in that
> direction was blocked by associating wrong ideas with the
> class syntax.


One reason I really resisted use of the keyword "static", in this context, but water and bridges...

Allen





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



More information about the es-discuss mailing list