Template site objects and WeakMap

Andrea Giammarchi andrea.giammarchi at gmail.com
Wed Jun 17 23:15:12 UTC 2015

this is puzzling me too ... so I've got few cases

  1. you want/need a one to many relations, Symbol as key, Array as value,
and you play with that Array values as needed per each Symbol used as key
in the very same WeakMap
  2. you invert the logic and you have a WeakMap that checks per each
object of the value Symbol has been set already
  3. you want to use that very same Symbol with that object, but that objet
is not extensible, so you fallback through a private WeakMap that
associates such object instead of using Symbol directly

which case was that?


On Wed, Jun 17, 2015 at 10:08 PM, Mark S. Miller <erights at google.com> wrote:

> I am curious about what these are? But regardless, I would expect there to
> be examples where it would be useful if it weren't fatal. Regarding the
> issues in this thread, it actually would be safe to allow unregistered
> Symbols as keys. But unless these examples are tremendously compelling,
> please let's not.
> On Wed, Jun 17, 2015 at 1:51 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
> wrote:
>> On Jun 17, 2015, at 9:18 AM, Mark S. Miller 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!
>> No, symbols are not objects and the keys of WeakMaps must be objects.
>> BTW, some people have identified use cases where allowing symbols values
>> as WeakMap keys would be useful.
>> Allen
> --
>     Cheers,
>     --MarkM
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150618/13c21b4d/attachment.html>

More information about the es-discuss mailing list