Niko Matsakis wrote:
- Why do you say Java doesn't have a weakmap? What is the
   [WeakHashMap][2] class if not a WeakMap? Presumably we are using the
   term differently? (I imagine there are many variations of weakmaps
   which vary in subtle but significant ways)

Quoting from [2]:

"*Implementation note:* The value objects in a WeakHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded."

In contrast, an ES6 WeakMap is an ephemeron table, where the keys and values can be twisted into cycles, but so long as no live key object remains, the whole knot can be cut and collected. See http://en.wikipedia.org/wiki/Ephemeron (but Allen's testimony trumps this page, given his being in the room when Ephemerons were discovered).

/be
_______________________________________________
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to