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

inheriting data slots



A question I've had about self since I read the self intro paper in
OOPSLA is how you inherit data slots.  I read the Organizing Programs
Without Classes paper, and that sort of answered it, but I want to
make sure that I'm not missing anything...

Using an extra parent slot (like dataParent in the example in the
paper), you model data inheritance by copying a list of prototypes
when you clone an object.  That would be these slots in a traits
object:

dataParent: arg = ().
copy = (| new. |
	new: resend.copy.
	new dataParent: dataParent copy.
|).

Then, for each object inheriting those slots that wanted to inherit
data from an object 'o', you just define a slot:

dataParent** <- o.

By doing this, I'm trying to share some format information as well as
behavior.  Is there a better way to do this, or is this 'the right
way?'

	-- Bill
	burdick@mentor.cc.purdue.edu