Hi

> if you look at the problem in wider perspective, then right question
> to ask, is how to deal
> with objects which are register themselves in global facilities, like
> weak finalization,
> startup/shutdown lists etc.

Fuel can handle globals... but I don't understand how can weak objects be accessed as global. Could you give a snippet�exemplifying, please?

Martin

On Tue, Sep 20, 2011 at 11:03 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 21 September 2011 03:15, Schwab,Wilhelm K <bschwab@anest.ufl.edu> wrote:
> 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 main problem i think is to make fuel to know which objects are
belong to your model, and which is not.
because in Levente's suggestion, this makes a difference between
either serializing a pointer or just replacing it with nil.

But then, once you introduce "this object belongs to my model" logic,
a new question immediately arises: what if some object strongly
referencing an object outside your model?
So, the problem is more general than just do it selectively only for
weak containers. Either you doing it uniformly (providing facilities
to deal with everything which outside your domain/model somehow),
or you just walk the graph and storing everything (treating all object
found as ones , who belong to your model). And there is nothing
special to do with weak containers.

> 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
>>>
>>
>>
>
>
>



--
Best regards,
Igor Stasenko.