help-smalltalk
[Top][All Lists]
Advanced

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

Re: [Help-smalltalk] typo in MessageLookup


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] typo in MessageLookup
Date: Sat, 04 Feb 2012 14:19:17 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]