[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

elimination in memory

Right now we occasionally suffer from the difference in deletion
semantics between smalltalk and c++.  If a smalltalk destructor in a
superclass sends a message to self, it uses the class of the original
object whereas c++ uses the class in which the destructor is defined.

NOTE:  I especially suffer from this incompatibility because I'm
trying to make deletion work in memory and on disk at the same time.

Here's how to make these consistent:

define a message 'destruct' in Heaper that calls the heaper
destructor.  Replace all implementations of destructors to an
equivalent definitions of 'destruct' methods for those classes.  Since
destruct is a message, it will use the original class of the
'destruct'ing object.  Destroy and the garbage collector both need to
call 'destruct' instead of the actual destructor, of course.

Since I have to run, I will give you the example of the alternative:
each concrete subclass of Shepherd must define a destructor (delete)
to call 'self dismantleIfForgotten.  super delete'.  Yucho.