What is the status of Weak References?

David Bruant bruant.d at gmail.com
Fri Feb 1 07:07:54 PST 2013

Le 01/02/2013 15:53, Brandon Benvie a écrit :
> It's not possible to polyfill or emulate weak references (or WeakMaps 
> for that matter) in JS without completely disengaging from using the 
> host JS engine's object model.
For all practical purposes, you've done such a thing yourself 
https://github.com/Benvie/WeakMap ;-)

> In Continuum, for example, I can get close but not quite all the way 
> to emulating WeakMaps using a meta-interpretive approach to the object 
> model (each object in the VM corresponds to one or more objects in the 
> host engine). Eventually I'll switch to switching to using my own 
> typedarray-backed heap with a GC in order to fully realize the 
> semantics of WeakMaps.
There are probably minor limitations to your above implementation, but I 
wonder if they're worth the trouble to move to a typedarray heap. It's 
your call not mine anyway :-)


More information about the es-discuss mailing list