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):
TypeError.[[Prototype]] === Error,
Error.[[Prototype]] === Object,
Function.[[Prototype]] === Object,
Number.[[Prototype]] == Object
etc.; and ultimately
Object.[[Prototype]] === Function.prototype
? So that buitin constructor functions would have parallel hierarchy to
their prototypes (as is nice for proper class to behave)?
Herby
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss