Claus Reinke claus.reinke at
Sun Nov 4 01:58:59 PST 2012

> The set of values actually contained by the WeakMap at any moment is
> non-deterministic, depending on the scheduling of gc. But this
> non-determinism is non-observable. WeakMap.contains would make it
> observable.

a) this concise elaboration should be part of the spec, to reduce
    guessing about the design intentions

b) there is at least one use case where observing gc would be
    useful: instrumenting code for heap profiling; 

    since built-in heap profiling is supported in too few JS debuggers 
    atm, I was wondering whether there could be some reflection-
    level language support for "this object is no longer referenced",
    perhaps as an iterator for WeakMap; then tool builders could 
    use that, and standard users would be aware that this isn't a
    normal-level feature.


More information about the es-discuss mailing list