Adding a new imediate type

Andreas Raab andreas.raab at gmx.de
Wed Jan 11 04:45:55 UTC 2006


Alan Lovejoy wrote:
> Remember that nil is an instance of UndefinedObject, and that
> UndefinedObject is a subclass of Object.  The preexisting instance of nil
> must be recreated.  When it's recreated, it will have an instance variable
> whose value must be set to nil.
> 
> Do you begin to see the problem?

Not at all. There is no problem (not in Squeak at least - I don't know 
about others). It is implicitly being solved by the ultimate #become: 
operations that transmutates the old nil instance into the new nil 
instance.

E.g., when UndefinedObject is recompiled, we create an instance of 
UndefinedObject' (the class version with the extra iVar), which I'll 
call nil'. The iVar in nil' will be nil but the operation that (later) 
executes "nil become: nil'" will fix that properly.

The warning you get when you try to change UndefinedObject is just that 
- a warning that you should't do that but you can actually safely ignore 
it. I just did (for the fun of it).

Cheers,
   - Andreas



More information about the Squeak-dev mailing list