Adding a new imediate type

Alan Lovejoy squeak-dev.sourcery at forum-mail.net
Wed Jan 11 04:30:48 UTC 2006



I wrote:
> UndefinedObject is a subclass of Object.  If one adds an instance
> variable to Object, then nil will have an instance variable. It's
> value will of course initially be nil.
>
> What's the transitive closure?

Colin responded: "So? The nil instance would just have a pointer to its own
object header. It's no worse than any other cyclical set of object
references."

Have you tried it? The system will warn you not to do such a thing.  You can
modify the code that issues the warning--but I don't advise doing that in an
image you care about.

You haven't considered the issue deeply enough--although I admit I didn't
spell the situation out.  You're only considering the end state.  And as far
as the end-state is concerned, you're quite correct: it shouldn't be a
problem.  But how can the system get to that end state--especially
considering what the system will do whenever any class is redefined?

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?







More information about the Squeak-dev mailing list