Hi,
We want to do some processing over the graph of object references. Do you recommend an implementation of visitor pattern to iterate object instance variables? Best regards, Martin and Tristan
_______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Yes.
Visitor is a convenient pattern to perform a computation over each element of a recursive data structure. This pattern works well for trees. You need to pay attention to cycle when using it on a graph. This might be expensive if you have a large graph and you use a set to keep track of the element you run over. Do you want to do this on any object of the image? Alexandre On 2 Sep 2010, at 10:36, Martin Dias wrote: > Hi, > > We want to do some processing over the graph of object references. > > Do you recommend an implementation of visitor pattern to iterate object instance variables? > > Best regards, > Martin and Tristan > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
On Thu, Sep 2, 2010 at 4:53 PM, Alexandre Bergel <[hidden email]> wrote: Yes. It has to be as faster as possible, but I think that the Set would be ok. Do you want to do this on any object of the image? Yes, for any object. It's for serializing a graph of objects into a stream. We need to iterate over the transitive closure of object references.
Do you know an existing package that implements this pattern? Alexandre Thank you for the answer Martin
_______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
The Pharo image already provides some infrastructure: SmartRefStream, ImageSegment and friends.
Maybe Mariano could provide an extended answer... Cheers, Alexandre On 3 Sep 2010, at 03:54, Martin Dias wrote: > > > On Thu, Sep 2, 2010 at 4:53 PM, Alexandre Bergel <[hidden email]> wrote: > Yes. > Visitor is a convenient pattern to perform a computation over each element of a recursive data structure. > This pattern works well for trees. You need to pay attention to cycle when using it on a graph. This might be expensive if you have a large graph and you use a set to keep track of the element you run over. > > > It has to be as faster as possible, but I think that the Set would be ok. > > > > Do you want to do this on any object of the image? > > > Yes, for any object. It's for serializing a graph of objects into a stream. We need to iterate over the transitive closure of object references. > > Do you know an existing package that implements this pattern? > > > > > Alexandre > > > > Thank you for the answer > Martin > > > > On 2 Sep 2010, at 10:36, Martin Dias wrote: > > > Hi, > > > > We want to do some processing over the graph of object references. > > > > Do you recommend an implementation of visitor pattern to iterate object instance variables? > > > > Best regards, > > Martin and Tristan > > _______________________________________________ > > Pharo-project mailing list > > [hidden email] > > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > -- > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: > Alexandre Bergel http://www.bergel.eu > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. > > > > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by tinchodias
Hi Martin, a couple of questions:
- What you want to do with each obejct? I mean, you want to traverse the graph...ok, but to do what? - Do you want to do it at VM or image side? Is speed important? But as Alexandre said, you can take a look to ReferenceStream or ImageSegment. In VM side you can see the GC stuff for example. Cheers Mariano 2010/9/2 Martin Dias <[hidden email]> Hi, _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
In reply to this post by tinchodias
Hi Martin, the "Ma object serialization" package also handles object
serialization. It is available by loading the ConfigurationOfMagmaClient. 2010/9/3 Martin Dias <[hidden email]>: > > > On Thu, Sep 2, 2010 at 4:53 PM, Alexandre Bergel <[hidden email]> > wrote: >> >> Yes. >> Visitor is a convenient pattern to perform a computation over each element >> of a recursive data structure. >> This pattern works well for trees. You need to pay attention to cycle when >> using it on a graph. This might be expensive if you have a large graph and >> you use a set to keep track of the element you run over. >> > > It has to be as faster as possible, but I think that the Set would be ok. > > >> >> Do you want to do this on any object of the image? >> > > Yes, for any object. It's for serializing a graph of objects into a > stream. We need to iterate over the transitive closure of object references. > Do you know an existing package that implements this pattern? > > > >> >> Alexandre >> >> > > Thank you for the answer > Martin > > >> >> On 2 Sep 2010, at 10:36, Martin Dias wrote: >> >> > Hi, >> > >> > We want to do some processing over the graph of object references. >> > >> > Do you recommend an implementation of visitor pattern to iterate object >> > instance variables? >> > >> > Best regards, >> > Martin and Tristan >> > _______________________________________________ >> > Pharo-project mailing list >> > [hidden email] >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> >> -- >> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: >> Alexandre Bergel http://www.bergel.eu >> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. >> >> >> >> >> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |