Begin forwarded message:

From: "Eliot Miranda" <eliot.miranda@gmail.com>
Date: December 19, 2008 7:52:21 PM CEST
To: "The general-purpose Squeak developers list" <squeak-dev@lists.squeakfoundation.org>
Subject: Re: [squeak-dev] Re: Resume Problems
Reply-To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>

Hi Zulq,

    I made sure this was fixed in VisualWorks.  Steve Dahl and I fixed this together.  Here's an analogous fix for Squeak.  The essential change is to make Object>>doesNotUnderstand: check if the MessageNotUnderstood exception was handled or not, so 

MessageNotUnderstood new 
message: aMessage;
receiver: self;
signal.
^ aMessage sentTo: self.

is replaced with

(exception := MessageNotUnderstood new)
message: aMessage;
receiver: self.
resumeValue := exception signal.
^exception reachedDefaultHandler
ifTrue: [aMessage sentTo: self]
ifFalse: [resumeValue]

HTH

On Fri, Dec 19, 2008 at 8:13 AM, Zulq Alam <me@zulq.net> wrote:
Hi Klaus,


Klaus D. Witzel wrote:
Nah, the result has nothing to do with #on:do: resuming with 1, you better
try

[('abc' + 1) + 1]
  on: MessageNotUnderstood
  do: [:e | e resume: -1]

which still says 2. This because someone, behind you back, put #asNumber
arithmethic into ByteString ... now this attempts (Number readFrom: 'abc')
which gives 0 for your +1 +1 and so 2.

You may want to start DNU testing with ('abc' break; + 1) and then see
where it goes.

Hmm... I think something is not right or at the very least the semantics are subtly different than I expect.

VisualWorks:
[Object new blah + 1]
 on: MessageNotUnderstood
 do: [:e | e resume: 1]  " = 2 "

[MessageNotUnderstood signal + 1]
 on: MessageNotUnderstood
 do: [:e | e resume: 1] " = 2 "

Squeak:
[Object new blah + 1]
 on: MessageNotUnderstood
 do: [:e | e resume: 1]  " infinite recursion!!! "

[MessageNotUnderstood signal + 1]
 on: MessageNotUnderstood
 do: [:e | e resume: 1] " = 2 "


If I look at doesNotUnderstand: in both I see that in VW the resumed value is returned. In Squeak is is not... surely this can't be right?

As for my problem, I think a simpler solution is to pass an adaptor/proxy object to the block rather than the tag itself. This adaptor can then marshal behaviour such that it will act as a message eating null if it receives an MNU from the tag it's looking after.

Thanks,
Zulq.