Security Demands Simplicity (was: Private Slots)

David Bruant bruant.d at
Sun Jan 20 03:04:06 PST 2013

Le 20/01/2013 05:27, Allen Wirfs-Brock a écrit :
> Weakmaps and symbol keyed properties (private or not) are very different mechanism.  They each have a variety of uses and differing implementation and performance characteristics.  It really is a distraction to focus exclusively on a single use case that might be supported by two different mechanism and use it to argue that only one of the mechanism is needed.
What are the different uses of private symbols?
More specifically: what are the remaining explicit uses of private 
symbols in a language with private syntax in classes?

I think symbols were introduced given experience in ES5 and assuming 
being an improvement on top of ES5 as we know it. On top of pure ES5, 
private symbols make a lot of sense. In ES5+class-with-private-syntax, 
I'm much more skeptical.

Also, private syntax as private symbol makes the proxy story complicated 
[1], because the class or its instances need to publicize private 
symbols so that proxies can add them to their whitelist when wrapping 
class instances. I don't think leaking abstraction is a valid option, so 
it means that only 2 out of the 3 following can be kept in the language:
1) proxy-wrapping class instances (without leaking abstractions)
2) private syntax in class
3) private symbols
We can probably predict in advance that JavaScript authors will largely 
not want to give up on 2) (even if it comes only in ES7). Should 1) or 
3) be given up? Unless relevant use cases different than class-like 
usages are provided, 3) can disappear in my opinion.



More information about the es-discuss mailing list