Subclass problem

Dan Ingalls DanI at wdi.disney.com
Tue Nov 10 03:47:30 UTC 1998


Ivan -

>I attempted to add an ivar to the Morph class, but upon recompilation the
>debugger stated that the ivar was defined in another class (SketchMorph).  
>
>I corrected the problem by changing the variable's name, but now
>almost all the subclass of Morph do not recognize that Morph is their
>superclass.  
>
>Upon further inspection, it appears that there are two definitions of
>Morph in the system.  Executing "implementors of it (m)" on a
>method defined in Morph returns two methods.
>
>Has anyone encountered this problem?  Any help will be appreciated.

Yes.  The check for conflicts is unfortunately not made before any changes.  Therefore you were partly through the process when you bailed out.  This leaves everything in a bad state with exactly the symptoms you describe.

The solution for you is (sorry to say) go back to where you were, and add an instvar with a name that does not conflict.

The solution for Squeak is to make this test before beginning its recompilation of the class hierarchy.  i'll try to get this into 2.3.

Thanks for the report.

	- Dan





More information about the Squeak-dev mailing list