Will any new features be tied to constructors?
bzbarsky at mit.edu
Thu Jul 2 04:26:17 UTC 2015
On 7/2/15 12:18 AM, Kevin Smith wrote:
> 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
Ah, I see. So what's observable is not whether things are a contiguous
chunk of memory or whatnot but rather whether the slots exist. And a
proposed invariant is that the slots, once observed to exist or not
cannot change that state. Is my understanding correct now?
> Are you suggesting that the DOM could define some magic way to
> dynamically allocate private slots and supposedly hide that fact from
> the user?
Not suggesting anything yet; just trying to understand the constraints
we have here.
As a matter of implementation, it would probably be possible to
implement private slots in the spec sense in a way that can be
dynamically added to existing objects. But that's not the externally
visible behavior being proposed for private slots, which makes sense.
More information about the es-discuss