archives

« Bugzilla Issues Index

#3297 — Proposal of explicit inheritance way of [[CreateAction]].


So that it can use "super" keyword fully without using the class syntax by "Function.prototype.toMethod", I want to inherit [[CreateAction]] without using the "extends" keyword.

Function.prototype.toSubConstructor(superF)

When the toSubConstructor method is called on an object func with argument superF the following steps are taken:

1. Let newF be a new ECMAScript function object that has all of the same internal methods and internal slots as func.
2. If superF has a [[CreateAction]] internal slot, then
a. Set the value of newF’s [[CreateAction]] internal slot to have the same value as superF’s [[CreateAction]] internal slot.
3. Return newF.


note, a class declaration of the form:

class F extends superF {
constructor() {
//body
}
}

is mostly equivalent to

function F() {
//body
}
F.__proto__ = superF
F.prototype.__proto__ = superF.prototype

so you can just use that form of class syntax to define such functions.


both [[ClassAction]] and toMethod are gone from the ES6 spec.

so, the particulars of this suggest really aren't applicable any longer