[comp.lang.smalltalk] Siblings of Object

pec1439@isc.rit.edu (P.E. Cisek ) (02/22/91)

Has anybody experimented with creating Classes that are NOT subclasses
of Object?  I am using Smalltalk V/Mac, but this may pertain to other
implementations...

	I am working on  a VirtualObject that allows normal objects
to be unloaded into a file, and then retrieved as needed.  I'd like to
keep this class outside of the normal Object hierarchy, so that I can
write and receive my own "doesNotUnderstand" message.

	Creating the class is not too hard.  First I make it a subclass
of Object, to enter it into the Smalltalk dictionary.  Then I recompile
it as "nil subclass: #VirtualObject...", and remove its entry from
Object's list of subclasses.  There are several changes that must be
made throughout the system, to ensure that the ClassHierarchyBrowser
will include the VirtualObject, as well as searches for allReferences,
sendersOf, etc...

	Anyway, all this seems to work.  My problem is, every
once-in-a-while (about once per every 1000 tries), the message
"VirtualObject new" returns an UndefinedObject.  It appears not to be a
memory limitation (basicNew would report with a "system primitive
failed" message).  Does anyone have any hypotheses as to what's
happening?  Is it a result of the VirtualObject's unusual place in the
hierarchy?  And the final question, is there any way to fix/avoid this
problem?

Any help will be appreciated,

Paul Cisek