Will any new features be tied to constructors?
d at domenic.me
Wed Jul 1 03:31:03 UTC 2015
From: Allen Wirfs-Brock [mailto:allen at wirfs-brock.com]
> no, not in the way that I believe you intend
Can you explain why? Is the design you and Kevin have been working on based on lexical restrictions?
> It isn't that subclass specific private state "initialization" must be performed in the constructors. In the design that Kevin and I have been working on, the total number of private state slots (and some meta data for each one) must be knowable and fixed when an object is allocated (in other words, private slots cannot be added to an object after it is initially allocated).
This seems like it then compares poorly with weak maps for private state. It makes sense as a strong mode restriction, but not as a default one...
Anyway, the design for upgradable custom elements is based around the idea that subclasses would never need to customize the allocator, thus allowing the UA to do their magical allocation of C++ HTMLElement stuff. If private state requires customizing the allocator, I am not sure that custom elements would be able to take advantage of it anyway... I suppose it depends on the details of the proposal.
More information about the es-discuss