> > I actually do have a related question, though. In the private state > proposals we're talking about, how would it be observable whether the > private slots the class defines are in fact allocated as part of the > object's allocation or separately? >
Not sure I understand the question. If the internal shape is fixed from birth (allocation-time), there is no way to allocate private slots separately. Are you suggesting that the DOM could define some magic way to dynamically allocate private slots and supposedly hide that fact from the user? Only if you consider object identity and "===" as meaningless : ) let el = document.createElement("foo-bar"); let Custom = class extends HTMLElement { private @x; initElement() { this.@x = 1; } getX() { return this.@x; } }; try { Custom.prototype.getX.call(el); // throws a TypeError: no @x } catch (x) {} document.registerElement("foo-bar", Custom); Custom.prototype.getX.call(el); // No type error, returns 1
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss