But how does Fuel "know" that the objects are not otherwise referenced? The idea of ignoring weak collections sounds a lot like a compiler optimization that sounds efficient and harmless - sometimes they cause huge problems. Think of it this way, if the objects are not otherwise referenced, sure they will be gc's soon - why are are they still around??? The comments re globally registered objects are well taken too. Dolphin's proxies are a great way to handle such things: some objects delegate their serialization to a proxy that contains logic to do global registration, etc. Bill ________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Nicolas Cellier [nicolas.cellier.aka.nice@gmail.com] Sent: Tuesday, September 20, 2011 6:08 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Should a serializer do something in particular with weak references? 2011/9/21 Levente Uzonyi <leves@elte.hu>:
On Tue, 20 Sep 2011, Mariano Martinez Peck wrote:
Hi guys. Martin and I were discussing whether we should do something in particular in Fuel with Weak references, such as WeakArray. Should we serialize it the same way we serialize all objects, or should we do something special? what could be the impact of materializing such weak references in a new image for example?
You should ignore (serialize nil instead of them) the elements of a weak object (#weakSubclass:...) which aren't referenced strongly from other serialized objects.
Levente
Ach, you commited shorter and quicker ;) Nicolas
Thanks your sharing your thoughts.
-- Mariano http://marianopeck.wordpress.com