How to store live objects in Monticello?

Matthew Fulmer tapplek at gmail.com
Mon Feb 12 05:27:08 UTC 2007


On Sun, Feb 11, 2007 at 10:07:48PM -0500, Milan Zimmermann wrote:
> Hi,
> 
> I am trying to do something like this: I have a class LoadProjectTest that is 
> essentially a singleton and the LoadProjectTest  class is in category 
> eToys-Tests. I'd like to do something like this: In the image where this 
> class originates, I am creating the instance, and setting one instance 
> variable with some value from a local file. I'd like the instance to be 
> stored in Monticello, when I "save" the category. Then, when the MCZ is 
> loaded into another image, the instance would be there, filled with the value 
> as created in the originating image. 
> 
> However, when I load the MCZ into another image, the instance is null; 
> although I was assuming otherwise, that makes sense as the Monticello 
> repository stores code not live objects.
> 
> Is it possible to, somehow, to make Monticello to keep the instance, so it is 
> deserialized from the MCZ when the MCZ is loaded into the target image?

You would write some class initialization code that creates this
instance, and stores it where you see fit. Put your code in the
class-side initialize method. 

A good example of a code that does just that is the class
ExternalType in category FFI-Kernel. Look at the methods in
category "class initialization"

> Thanks Milan

Hope it helps.

-- 
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808



More information about the Squeak-dev mailing list