How to store live objects in Monticello?

Bert Freudenberg bert at freudenbergs.de
Mon Feb 12 12:21:58 UTC 2007


On Feb 12, 2007, at 4:07 , 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?

I'm not sure that is a good idea, but in principle, yes, this is  
possible.

MC is extensible, it asks each class in the package it is going to  
store for its "classDefinitions". You can return an Array with  
multiple definitions, not only the MCClassDefinition that is usually  
returned. You could try to add a special MCDefinition that would  
represent a serialized instance. Might be quite hard, though.

Much easier would be to use a SAR that can bundle an MCZ with any  
other files.

- Bert -





More information about the Squeak-dev mailing list