Private Slots

Sam Tobin-Hochstadt samth at ccs.neu.edu
Mon Jan 14 09:05:58 PST 2013


On Mon, Jan 14, 2013 at 11:50 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
>
> On Jan 14, 2013, at 8:38 AM, Kevin Smith wrote:
>
>
>> There is no "new kind of slot".  Symbols, private and otherwise, go in
>> exactly the same kind of slot as any other object property.
>
>
> Slots keyed with private symbols have different, novel behavior.  Behavior
> that did not exist before.  At the very least, these slots are:
>
> 1) Strongly non-reflective
> 2) Unfreezable
>
>
> Private named slots can be  "frozen"  just like any slot by setting their
> writable and configurable attributes to false.  It is just that the
> Object.freeze function does not do so for such properties.

And again, `Object.freeze` can be thought of as simply enumerating the
accessible properties and freezes them, which works unchanged with
private symbols, since they are not reflectively accessible via
getOwnPropertyNames.

Sam


More information about the es-discuss mailing list