Ducks, Rabbits, and Privacy
domenic at domenicdenicola.com
Tue Jan 22 07:34:08 PST 2013
> The fact that ES built-ins' methods are defined on the prototype **and** have access to private data seems to indicate that the ideal model would allow both. WeakMaps do, to a degree, permit both, but it's just a hack. If it wasn't, the ES spec itself would describe built-ins' private data as living outside the object itself in a WeakMap. The spec doesn't do that because it's unnatural. Private symbols provide a mechanism for tying private data to objects in the most natural and reasonable way.
+1 to this and everything else Nathan has said. Watching all this intense back and forth, there are a lot of good points, some of which almost convince me that weak maps are sufficient and private symbols are unnecessary. But when I step back for even a minute, as a developer private symbols are exactly what I want, and weak maps are an un-ergonomic hack.
So I don't have any overwhelming technical or security arguments, but just from a developer ergonomics and pedagogy perspective, I <3 private symbols and wish I could banish the grim reaper that seems to be hanging over them.
More information about the es-discuss