Mess with obsolete classes???

Nathanael Scharli n.schaerli at gmx.net
Thu Feb 14 21:06:05 UTC 2002


Andreas,

When I add a new instance variable to class and accept it, all the
subclasses of class are being recreated with the new format. At one point,
'Class class' is reshaped. This means that all the instances of this class
have to be transformed (happens in the method ClassBuilder>>update:to:).
Since 'Class' is the sole instance of 'Class class', this code tries to
transform this instance, but it fails because 'Class' is referenced by other
methods in the current runtime stack ('Class' is the class that actually
gets a new instance variable and this happens *after* all its subclasses are
reshaped!). This results in an error (self error: 'Illegal pointers to
obsolete instances found') which stops the whole updating process.

To avoid this problem, I don't reshape 'Class class' and its instance
'Class' right away. Instead, I do it after all the other classes and
instances are transfomed. It works without a problem and the system remains
in a comletely consistent state.

(My original email was a bit confiusing, because the problem with the
inconsistent obsolete classes is not caused by this transformation. In fact,
I just discovered it when I checked whether all the inheritance and instance
relations are correct).

I'm pretty convinced that it is not possible to add a new instance variable
to Class in the normal way (changing the class definition and hit accept).
Even if I do that twice. Nevertheless, I'm very curious whether the way you
describe would still work. Maybe I didn't understand it right. Can you
reproduce it?

Cheers,
Nathanael

> Nathanael,
>
> > I'm doing some experiments with a sort of mixins in Squeak,
> > and therefore, I had to add a new instance variable to the class
> > 'Class'. Because of the circular meta-structure of Squeak
> > ('Class' is an instance of 'Class class', which is again an
> > (indirect) subclass of 'Class'), I had to patch the
> > ClassBuilder to make this work.
>
> Can you say something about the problem here?! Last time I tried to add
> an instVar to Behavior it worked like a charm - all that is required is
> to do the recompilation twice (heh, heh) but ClassBuilder used to be
> able to do this.
>
> Cheers,
>   - Andreas




More information about the Squeak-dev mailing list