Problem serializing graphs with Magritte proxies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem serializing graphs with Magritte proxies

Mariano Martinez Peck
Hi Lukas. I was serializing Pier kernels with Fuel and I started to face problems with Magritte proxies. Since I have no idea how/why they are use, I need to ask a couple of question. Imagine I want to serialize a graph (like a Pier kernel) that contains instances of MADynamicObject, like

 MAMultipleOptionDescription new
        default: [ self defaultViewClasses ] magritteDynamicObject;
        options: [ self defaultViewClasses ] magritteDynamicObject;
....

So the questions are:

- When I MATERIALIZE the graph, would you like to
a) still have the proxies exactly as it was during serialization ? 
b) or would you expect that objects refer directly to the target of the proxy (proxies do not even exist) ?

If you want a) then there are problems that I have to fix because for example I put objects (proxies) in a IdentitySet/IdenitityDictionary (which of course #== is not intercepted by the proxy) but then when I do #instVarAt: or #basicAt: etc, from the serializer, it intercept the messages and forwards to the target. This makes things complicated in Fuel but we can solve it.

b) can be achieved with the hook of a #objectToSerialize where each class can implement such message and not necessary answer self but something different. In this case, the proxy can answer the target.

So....depending what is the best scenario for the materialization, I can choose which of the options to do.

Thanks in advance,

--
Mariano
http://marianopeck.wordpress.com


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Problem serializing graphs with Magritte proxies

Lukas Renggli
Hi Mariano,

> Hi Lukas. I was serializing Pier kernels with Fuel and I started to face
> problems with Magritte proxies. Since I have no idea how/why they are use, I
> need to ask a couple of question. Imagine I want to serialize a graph (like
> a Pier kernel) that contains instances of MADynamicObject, like
>
>  MAMultipleOptionDescription new
>         default: [ self defaultViewClasses ] magritteDynamicObject;
>         options: [ self defaultViewClasses ] magritteDynamicObject;
> ....

The reason to have them is to allow Magritte to cache the description
instances, while certain properties can still adapt to the model.

> So the questions are:
>
> - When I MATERIALIZE the graph, would you like to
> a) still have the proxies exactly as it was during serialization ?
> b) or would you expect that objects refer directly to the target of the
> proxy (proxies do not even exist) ?

It doesn't really matter because the descriptions that end up part of
the model are just there to identify a certain described value. The
description itself is not used other than to compare it with other
descriptions. So the best is probably if you just nil the proxies on
serialization.

Lukas


--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Problem serializing graphs with Magritte proxies

Mariano Martinez Peck


On Sun, Aug 21, 2011 at 10:32 AM, Lukas Renggli <[hidden email]> wrote:
Hi Mariano,

> Hi Lukas. I was serializing Pier kernels with Fuel and I started to face
> problems with Magritte proxies. Since I have no idea how/why they are use, I
> need to ask a couple of question. Imagine I want to serialize a graph (like
> a Pier kernel) that contains instances of MADynamicObject, like
>
>  MAMultipleOptionDescription new
>         default: [ self defaultViewClasses ] magritteDynamicObject;
>         options: [ self defaultViewClasses ] magritteDynamicObject;
> ....

The reason to have them is to allow Magritte to cache the description
instances, while certain properties can still adapt to the model.


Ok, I understand.
 
> So the questions are:
>
> - When I MATERIALIZE the graph, would you like to
> a) still have the proxies exactly as it was during serialization ?
> b) or would you expect that objects refer directly to the target of the
> proxy (proxies do not even exist) ?

It doesn't really matter because the descriptions that end up part of
the model are just there to identify a certain described value. The
description itself is not used other than to compare it with other
descriptions. So the best is probably if you just nil the proxies on
serialization.

Excellent!!! that worked out of the box with the just developed hook by Martin in Fuel. I can now do:

MADynamicObject >> fuelAccept: aVisitor 
    ^ aVisitor visitSubstitution: self


MADynamicObject >> fuelSubstitution 
    ^ nil

And that's all :)

Thanks Lukas.

 

Lukas


--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki



--
Mariano
http://marianopeck.wordpress.com


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki