Template site objects and WeakMap

Yusuke SUZUKI utatane.tea at gmail.com
Wed Jun 17 16:31:51 UTC 2015


On Thu, Jun 18, 2015 at 1:18 AM, Mark S. Miller <erights at google.com> wrote:

> [+Allen]
>
> Can registered Symbols be used as keys in WeakMaps? If so, we have a fatal
> unauthorized communications channel that we need to fix in the spec asap!
>
>
>
Why do registered Symbols appear? (oops, maybe I missed some context...)
User exposed WeakMap only accepts objects as a key.

In an inverted per-object table implementation, I've talked in this
context[1, 2]
Now, because iteration and clear method are dropped, we can implement
WeakMap as an inverted per-object table instead of Ephemerons[3].
The last implementation example shows that my "converting
realm.[[tempateMap]] into WeakMap" proposal can be implemented even if the
WeakMap is implemented as an inverted per-object table.

Of course, if we take an inverted per-object table, private symbols should
be treated specially in the implementation :)
1. we need to carefully extend the object with private symbols even if the
object is frozen.
2. private symbols' lookup system should not be trapped by ES6 Proxy.
3. private symbols should not be exposed to users.

[1]: https://twitter.com/awbjs/status/535830604269355008
[2]: https://esdiscuss.org/topic/removal-of-weakmap-weakset-clear
[3]: http://dl.acm.org/citation.cfm?id=263733
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150618/f660fc2a/attachment.html>


More information about the es-discuss mailing list