Recursive #doesNotUnderstand:

Lex Spoon lex at cc.gatech.edu
Mon Aug 20 04:30:06 UTC 2001


Mark Guzdial <guzdial at cc.gatech.edu> wrote:
> >It seems kind of harsh that Squeak crashes on a recursive
> >#doesNotUnderstand: (when an object (a subclass of nil) does not
> >understand #doesNotUnderstand:).
> 
> This is a HUGE issue for my students, who are just learning about 
> changesets and filing out categories/classes.  They often create 
> classes with nil superclasses, which leads to the kinds of crash that 
> Stephen describes.
> 

Ah, good point.  I was trying to figure out why nil superclasses matter -- I've made perhaps one, intentionally, in 4 or so years of Squeaking (since whenever it was put on the Internet).  But these accidental ones sure do seem to crop up.

I think the best solution of all would be to manufacture classes that
don't exist, making them subclasses of Object.  However, it's hard to
implement this with the current fileout format.  Instead of:

	Foo subclass: #Bar etc:etc:

it would be much easier if we had something like:

	Smalltalk makeSubclassOf: #Foo named: #bar etc:etc:


Barring that, perhaps a nil superclass should simply put up a notifier, similar to the one if you accidentally redefine things like class Class ?  People are unlikely to have done this on purpose.  The only downside is that a good many of these come from people filing in file-outs in the wrong order, and sometimes there migth not *be* a right order.  But it would at least warn them that something is going on.  Here's a try at some text:

'WARNING: nil Superclass

You are creating a subclass of nil.  This is probably a mistake, and it can lead to the entire VM crashing with a "recursive doesNotUnderstand:" error.  Proceed if you want, or Abort to avoid making the subclass.'



-Lex




More information about the Squeak-dev mailing list