On Tue, Jan 22, 2013 at 9:01 AM, David Bruant <[email protected]> wrote:

>     class WeakMapWithoutClear {
>

Yep. Glad to see we are thinking along the same lines.


> What this and my previous show is an semantics equivalence between
> clearable and clear-less weakmaps. Which should be chosen as default?
> * clear-less weakmaps have better integrity properties.
> * clearable weakmaps may have better performance characteristics (I'm
> still not entirely convinced)
>

Well, I disagree a little with the wording here! I'd put it like this:

* clear-less weakmaps are more convenient when you need
  a particular invariant, useful in implementing rights amplification;

* clearable weakmaps are more convenient when you want
  to clear a WeakMap.[*]

To me, the wording "better integrity properties" suggests an integrity
property that benefits all code using WeakMaps. But as far as I can tell,
very few use cases would really benefit.

Separately: APIs should make easy things easy and hard things possible,
right? So far, all the proposed use cases of non-clearable weakmaps are
complex and security-sensitive. If you're already doing something that
exciting, you can write WeakMapWithoutClear with your eyes closed. By
contrast, use cases for .clear() are pretty simple. Clearing caches. The
sort of thing where having to write a wrapper class might actually be an
annoying marginal cost.

Cheers,
-j

[*] Also some sort of performance thing that will totally check out if you
take the time to look into it! :)
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to