Use cases for WeakMap

Erik Corry erik.corry at gmail.com
Mon May 16 00:18:34 PDT 2011


2011/5/16 Brendan Eich <brendan at mozilla.com>:
> On May 16, 2011, at 12:01 AM, Brendan Eich wrote:
>
>> On May 15, 2011, at 11:55 PM, Erik Corry wrote:
>>
>>> 2011/5/16 Brendan Eich <brendan at mozilla.com>:
>>>> Not if the object is frozen.
>>>
>>> That shouldn't prevent you adding private names.  See earlier message
>>> in this thread.
>>
>
>> Frozen means [[Extensible]] is false, so you can't add any properties, ...
>
> I'll go further: frozen means the implementation should be free to move the object and anything associated with its shallow-frozen key/value state into read-only memory, so the full force of 50-year-plus OS and hardware MMU protection can ensure [[Extensible]] really is false.

I think this would also preclude the most efficient implementation of
Weak Maps.  In fact I have a hard time seeing how you would GC weak
maps at all under these conditions.

-- 
Erik Corry


More information about the es-discuss mailing list