Private Slots

Mark S. Miller erights at
Tue Jan 15 15:46:47 PST 2013

On Tue, Jan 15, 2013 at 3:27 PM, Allen Wirfs-Brock
<allen at> wrote:
> On Jan 15, 2013, at 3:18 PM, Mark S. Miller wrote:
>> On Tue, Jan 15, 2013 at 3:03 PM, Allen Wirfs-Brock
>>> To start with, WeakMaps uses ephemeron algorithms
>> Not those with the hint. That's the point. Are you getting my
>> messages? Are they unclear? Please ack even if you have no other
>> response. Thanks.
> Sorry, where is this hint proposal described?

My message in this thread at 1:54pm. Quoting

Independent of this hint, wm.set(key, value) needs to make value
reachable if wm *and* key are reachable. In the absence of this hint,
to assess the space complexity of an algorithm expressed using
WeakMaps, we may assume that the value is not made reachable any
longer than that[1]. With the hint, we may only assume that the value
does not outlive the key. It may very well outlive the WeakMap. This
allows an implementation to use exactly the same implementation
techniques internally for these wimply weak maps that we expect them
to use for private symbols.

[1] if not otherwise reachable of course

> Regardless, the original request for information about the GC impact of using WeakMaps was presumably based upon the accepted WeakMap semantics.

Are space reclamation expectations semantic? We never decided to make
them normative. If we do, then yes. But the hint still has no
semantics beyond their space reclamation semantics. This arguably make
the hint simpler than private symbols.

A note to avoid misunderstanding:

I have been very careful in this thread not to advocate that we drop
private symbols. But if we keep them, it should be on grounds other
than performance. I am arguing here only that the performance argument
is a red herring.

> Allen


More information about the es-discuss mailing list