Will any new features be tied to constructors?
Kevin Smith
zenparsing at gmail.com
Wed Jul 1 15:31:10 UTC 2015
>
> ```js
> class Derived extends Base {
> constructor(...args) {
> super(a, b, c);
> doInitCode(this, ...args);
> }
> }
> ```
>
> via a function
>
> ```js
> function makeDerived(...args) {
> const o = Reflect.construct(Base, [a, b, c], Derived);
> doInitCode(o, ...args);
> return o;
> }
> ```
>
That's still theoretically possible, because new.target (Derived in this
case) carries with in the list of slots that must be allocated. Once we
"super up" to the root constructor, the allocator gets that list from
new.target.
But as I understand it, the difficulty for HTML element subsclassing is
that you don't event know what "Derived" might be until sometime later.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150701/72bfe623/attachment.html>
More information about the es-discuss
mailing list