Private Slots

Brendan Eich brendan at mozilla.com
Fri Jan 18 01:17:59 PST 2013


Claus Reinke wrote:
>> Object.freeze deals in certain observables. It does not freeze 
>> closure state, or weakmap-encoded state, or (per the ES6 proposal) 
>> private-symbol-named property state where such properties already 
>> exist. Those are not directly observable by the reflection API.
>
> True, private symbols as first-class objects can hide anywhere.
>

...

>> Your -- as in You the abstraction implementor -- may indeed make such 
>> state observable. 
>
> But if I do not have a way to hook into freeze, etc, how do I make
> my objects with hidden state behave like objects with exposed state? 

You don't, for a non-proxy. For a proxy, you can do what you like via 
the whitelist and unknownPrivateSymbol (or better, if there's a better 
way to handle whitelist misses).

/be


More information about the es-discuss mailing list