question about method dispatch

Bergel Alexandre bergel at iam.unibe.ch
Fri May 10 19:42:34 UTC 2002


I am really wondering in which case you might need to do that...

Alexandre


On Fri, May 10, 2002 at 04:01:56PM -0300, Jessie Dedecker wrote:
> MessageHello again,
> 
> thanks for replying so soon :)
> 
> I already took the optional of the #doesNotUnderstand: method into account, however I would like to change the dispatch for <all> objects and <all> messages, also existing ones.
> But if I understood you correctly there is no way to change the dispatch using the reflective capabilities of Smalltalk?  So I should start looking at the C-code instead or did I understood it incorrectly?
> 
> Thanks,
> 
> Jessie Dedecker
>   ----- Original Message ----- 
>   From: Stephen Pair 
>   To: squeak-dev at lists.squeakfoundation.org 
>   Sent: Friday, May 10, 2002 3:46 PM
>   Subject: RE: question about method dispatch
> 
> 
>   If I understand your question correctly, you cannot change the method dispatch algorithm in Squeak without modifying the VM.  However, you can simulate a custom dispatch algorithm using the #doesNotUnderstand: method.  That method gives you an instantiated message object and you are free to interpret the message any way you like.  The downside is that it's slower, and any actual methods implemented on your object will mask the #doesNotUnderstand: method (#doesNotUnderstand: is sent whenever the VM cannot find a method in the method dictionary (or a superclass' method dictionary) that matches the selector).  The argument is a reified version of the message that was sent, but not understood (hence the name).  Have a look at Interpreter>>internalFindNewMethod (and related methods) to see where the VM implements the dispatch algorithm.
> 
>   - Stephen
>     -----Original Message-----
>     From: squeak-dev-admin at lists.squeakfoundation.org [mailto:squeak-dev-admin at lists.squeakfoundation.org] On Behalf Of Jessie Dedecker
>     Sent: Friday, May 10, 2002 2:36 PM
>     To: squeak-dev at lists.squeakfoundation.org
>     Subject: question about method dispatch
> 
> 
>     Hello,
> 
>     could anyone please tell me how I can change the method dispatch in smalltalk.  I tried to change the ContextPart>>send:super:numArgs: but I guess
>     this doesn't work because of optimisations that were performed.
> 
>     Is there a way to change the dispatch?
> 
>     Thanks,
> 
>     Jessie Dedecker

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._
Bergel Alexandre  http://www.iam.unibe.ch/~bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^



More information about the Squeak-dev mailing list