Login  Register

Re: typo in MessageLookup

Posted by Paolo Bonzini-2 on Feb 04, 2012; 1:19pm
URL: https://forum.world.st/typo-in-MessageLookup-tp4336704p4357066.html

On 02/03/2012 07:49 PM, Ladislav Marek wrote:

> diff --git a/packages/stinst/parser/STLoaderObjs.st
> b/packages/stinst/parser/STLoaderObjs.st
> index 6eda6e1..72deded 100644
> --- a/packages/stinst/parser/STLoaderObjs.st
> +++ b/packages/stinst/parser/STLoaderObjs.st
> @@ -812,6 +812,7 @@ superclass
>   !
>
>   doesNotUnderstand: aMessage
> +    aMessage startingClass: proxy class.
>       ^proxy perform: aMessage
>   ! !

Actually, #doesNotUnderstand: can do one of three things:

1) do everything by itself;

2) forward the message to another object;

3) create the missing method and retry it.

(3) is relatively rare, but it is the scenario for which I introduced
MessageLookup.  It turns out that the new MessageLookup>>#sendTo: is
only good for (3), and the old implementation from the Message class is
appropriate for (2).

I'm applying this patch to differentiate how you restart execution in
the two cases:

diff --git a/kernel/MessageLookup.st b/kernel/MessageLookup.st
index bbc18f2..dc9e831 100644
--- a/kernel/MessageLookup.st
+++ b/kernel/MessageLookup.st
@@ -71,8 +71,9 @@ but also the starting class for the search.'>
          ^self startingClass lookupSelector: self selector
      ]

-    sendTo: receiver [
- "Send the message to the given receiver"
+    retrySendTo: receiver [
+ "Send the message to the given receiver, looking up the
+         method starting at #startingClass."

  <category: 'basic'>
  ^receiver perform: self method withArguments: self arguments

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk