Le 12/11/2013 10:18, Pierre Frisch a écrit :
Could I present another example where WeakRef are required.

I am writing an object management layer similar to what exist in other language 
and systems. One of the requirement is uniquing so that each object exist only 
once in memory. Let say I retrieve a company and its employees and later 
retrieve a company project and its participants. I need the members of the 
employee list and the members of the participant list to point to the same 
objects. The other requirement is not to leak, if an object is only accessible 
from within the management layer it should be candidate for garbage collection.
Your description suggests that there is an external source of truth dictating which objects are expected to be the same. I imagine ids in a database. I feel your use case is very close what has been covered so far with attempts to reimplement CapTP or the Cap'n'proto protocol in JS. These contain a form of object management layer like the one you describe. Among other things, they preserve object identity within one Vat.

David
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to