"Static" inheritance of builtins

Allen Wirfs-Brock allen at wirfs-brock.com
Sun Jan 29 11:43:44 PST 2012


On Jan 28, 2012, at 12:54 PM, Herby Vojčík wrote:

> Hello,
> 
> in ES, inheritance between "classes" was in fact only inheritance between their prototypes; the constructor functions always inherited from Function.prototype directly.
> 
> Now, <| operator defines that
>  Fun <| function SubFun (...) { ... }
> not only does parallel hierarchy so that
>  SubFun.prototype.[[Prototype]] === Fun.prototype, but also
>  SubFun.[[Prototype]] === Fun.
> So constructor functions ultimately descend from Function.prototype, but it may be indirectly. "Subclasses" themselves also inherit "static" properites from their superclass.
> 
> Would it break things if this would be true for builtins, as well? So that (for example, not citing all):

It would certainly be observable.  Whether is would actually breaking anything can only be speculated at this point until somebody tries it in a widely used implementation. My speculation is that no breakage would occur. Is this important enough to try?

Allen





More information about the es-discuss mailing list