Does the ECMAScript specification allow Array to be “superclassable”?
Does the ECMAScript specification allow Array to be “superclassable”? I'm looking for any indications whether or not "superclassing" a builtin type will work according to the specification . That is, given any hypothetical conformant implementation of ECMAScript, does "superclassing" a builtin break the runtime by affecting the creation algorithm of the class constructor? "Superclassable" , a term I'm coining, refers to a class whose objects returned by constructing it, or calling it as a function if applicable, will be created with the same internal slots (except for [[Prototype]]), regardless of what its direct superclass is, as long as the initial [[Prototype]] of the class constructor and the class prototype are still in each respective inheritance chain after reassigning them. Consequently, in order to be "superclassable", a class must not call super() during creation. super() When "superclassing" an Array , I would expec...