Preserving class instance variables in Monticello.

Ralph Johnson johnson at cs.uiuc.edu
Thu Dec 6 12:41:27 UTC 2007


On Dec 6, 2007 5:20 AM, Niko Matsakis <niko at alum.mit.edu> wrote:
> Hello,
>
> I have a project (Pepper) in which we use a few class instance
> variables.  Unfortunately, when we add these classes to the Monticello
> project on Sourceforge, it seems that the class instance variables
> disappear (when the changes are loaded into a fresh image, the class
> instance variables are nil).  Is there a way to preserve those
> instance variables?

You need to write a class initialization method that initializes these
variables.

If you are constantly editing the class instance variable, and don't
want to have to keep changing the class initialization method, you
might consider writing some code that creates the class initialization
method automatically.  Normally, I would consider this overkill, but
it might be worth it for you.

> Also, we overloaded the method "definition" in our base metaclass so
> as to customize what appears in the System Browser when you visit the
> class definition, so that the additional variables are displayed.
> (i.e., instead of "SuperClass subClass:#ClassName ...", it displays
> custom text of our choosing which omits some fields and adds others).
> Is this the right way to make such a change?

This is the right way to make such a change.  However, this kind of
change is dangerous.  Your changes to metaclasses are likely to
conflict with other people's changes to metaclasses.  But if you are
willing to take that risk, go ahead.

-Ralph Johnson



More information about the Squeak-dev mailing list