On Sun, Nov 4, 2012 at 3:58 AM, Claus Reinke <[email protected]>wrote:

> 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
>

Definitely worth a note.

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

Firefox has a function,
Components.utils.nonDeterministicGetWeakMapKeys(weakmap), that can observe
GC in this way. Only privileged code (the browser itself, addons, and
certain tests) can use it. Web scripts can't.

When implementation details get exposed as part of a platform, programs
start depending (often unintentionally) on them. Let's not expose memory
management implementation details to the Web.

-j
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to