Q: Fun with Behavior (how to do Perspectives)

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Fri May 12 06:13:04 UTC 2000


To do Perspectives for real, one needs to be able to send the same message
to different perspectives on the same object. In other words, different
implementations of the same message in the same object.

This of course means trouble with MethodDictionary et al.

One way to do this is to store the messages under different pseudonyms, and
keep proxies that translate the names to their pseudonyms. But this is not a
good solution in the longer run.

So, is there a way to have multiple Behaviors for one object? Each of these
would contain the messages for one perspective, and you would redirect the
messages to the right one in some fashion.

(I guess a daring soul could swap the methodDict pointers in the Class just
before sending the message and then back again, but this sounds a bit unsafe
to me: bad things happen if the method is recursive or messages another
instance of the class)

How was multiple inheritance done for Smalltalk? Note that the
doesNotUnderstand: trick won't work here.

My own preliminary conclusion is that this would require some under-the-hood
stuff, like a new primitive.

Henrik






More information about the Squeak-dev mailing list