How to migrate instances when loading new change set?
Ned Konz
ned at bike-nomad.com
Sat Feb 23 19:02:44 UTC 2002
I've changed the structure of the ConstraintMorphs that my Connectors package
uses: they now use MessageSends rather than BlockContexts for their
parameterization.
Initially, at least, the same instance variable held the MessageSend that
previously held the BlockContext; i.e. the shape of the instances didn't
change.
I made a conversion method that would change one form to the other. When run
manually it works fine.
But I wanted to be able to have people load my new change set and have their
existing instances changed automatically. I also wanted it to work when
someone loaded a Project with the old form. So I added a
convertToCurrentVersion:refStream: method to my class that called the
conversion routine.
But I found that this method was not called when I loaded a project (perhaps
because the shape of the instances was the same?).
So I renamed the instance variable, to force the method to be called.
However, now I have the problem of loading the change set into images with
existing ConstraintMorphs. If I re-compile the class with the instance
variable renamed, the existing instances will lose their old BlockContexts,
which I need for the conversion to the MessageSend.
I've tried adding an instance variable with the new name and copying the
BlockContext in the preamble to the change set, but for some reason I end up
losing the connections upon conversion.
Before I spend a lot of time debugging this, is there an easier way to do
both of these:
* load old projects into images with the new code already
loaded and change the instances in the loaded projects
* load the new code into old images and convert the instances
Thanks,
--
Ned Konz
currently: Stanwood, WA
email: ned at bike-nomad.com
homepage: http://bike-nomad.com
More information about the Squeak-dev
mailing list
|