Eliminating superclass lookup in the VM (and dynamic composit ion of behavior)

Daniel Altman (Da Vinci) Daniel.Altman at disco.com.ar
Thu Dec 12 15:39:42 UTC 2002


Hi Stephen!

I'm a student at Univ. of Buenos Aires. At the OOP course we have
implemented something that might be usefull as a proof of concept to you.

The idea is to reify the message reception.

Basically we had an object that act as the "message receiver" for another
one. That means that if for example O1 is an object an MR1 is its message
receiver, then MR1 receives all the messages originally targeting O1. The
message receiver has a method "receiveMessage: aMessage" and you can write
your message receivers to do whatever you want in there. Examples are: just
forwarding the message to the original target (the default), logging, break
and call the debbuguer or simply call another method.

Message receivers can also be decorated with other message receivers and
plugged/unplugged from objects at runtime.

We thought of it as an interesting alternative to method wrappers.

If you are interested in it (or anyone else) , please let me know and I can
send you the implementation!

Best regards
Dany

________________________________________________________________________
________________________________________________________________________

Message: 18
   Date: Wed, 11 Dec 2002 13:43:48 -0500
   From: "Stephen Pair" <spair at acm.org>
Subject: RE: Eliminating superclass lookup in the VM (and dynamic
composition of behavior)

How about this:

Have a single method that all classes have, which is the "message
handler" method.  Such a method might look like:

: aMessage

	<primitive: normalMethodInvocation>
	"Failure code goes here"

The special syntax here would be that there is no keyword to this method
(just ":").  The default implementation in ProtoObject would have the
normal code for #doesNotUnderstand: inserted in place of "Failure code
goes here"...or it could simply make a call to #doesNotUnderstand:.  The
parameter could also be any kind of object (not just an instance of
Message).

Behaviors that need to specialize message lookup could override this
method.  This should be easy for the VM to optimize for the normal cases
(a bit flag could indicate to the VM which classes use this primitive).

- Stephen

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org 
> [mailto:squeak-dev-admin at lists.squeakfoundation.org] On 
> Behalf Of Stephen Pair
> Sent: Wednesday, December 11, 2002 1:30 PM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: RE: Eliminating superclass lookup in the VM (and 
> dynamic composition of behavior)
> 
> 
> I guess what I'm really after is the ability to have more 
> control over the manner in which behavior is composed.  So 
> far, the best platform for doing that seems to be Self.  
> However, even in Self, I think the message binding algorithm 
> is fixed.  It would be nice to be able to override the 
> default message binding algorithm that the VM employs.
> 
> - Stephen
> 


========================================
Daniel Altman
Da Vinci - Consultoría de Sistemas




More information about the Squeak-dev mailing list