WeakMaps question ?

Brendan Eich brendan at mozilla.com
Sat Nov 12 11:56:05 PST 2011


On Nov 12, 2011, at 9:19 AM, Allen Wirfs-Brock wrote:

> On Nov 12, 2011, at 5:10 AM, Russell Leggett wrote:
>>> 
>> 
>> Regardless of the implementation of primitive values, couldn't we say that the semantics of a weak map ignore primitive keys and look only at the value. Primitive keys are exceptionally common for maps, and this would open up a lot of potential uses, especially regarding caching.
>> 
> 
> 
> What you are asking for is a "weak array" (or an array of "weak references").  While some people think that such things have utility others are concerned that they expose GC based non-determination which they don't want to allow into the language.

WeakRef != WeakMap, we keep running into confusion between the two.

WeakRefs are useful for systems-builders. They should not be exposed to unprivileged code. Is there an object-capability security model that would work on the web, by which "frameworks" with some higher degree of trust could be introduced to WeakRef as a capability, while ordinary web content could not access WeakRef at all? I don't know of such a model, but perhaps Mark has ideas.

/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111112/973ff038/attachment.html>


More information about the es-discuss mailing list