Will any new features be tied to constructors?

Domenic Denicola d at domenic.me
Wed Jul 1 13:49:01 UTC 2015


From: Anne van Kesteren [mailto:annevk at annevk.nl] 

> In a world where custom elements are normal subclassed objects, they would just call super() from the constructor to set the browser-supplied bits and then add whatever else is needed themselves.

Yes, that is the Dmitry proposal.

> Or are you saying that super() would fully allocate the object

Yes, that is how ES2015 works.

> and prevent adding new private state

Apparently Kevin and Allen's private state proposal is based on private state being installed at allocation time, so yes, since super() fully allocates the object, this would prevent private state for custom elements.

Personally I think this is a definite negative for any such private state proposal, since it makes it significantly less expressive than weak maps. But I suppose when the proposal is proposed, we will have that discussion.

> (or other features tied to constructors)?

Well, it depends on if those features are tied to allocation (like this private state proposal) or to initialization.


More information about the es-discuss mailing list