[Top][All Lists]

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

[Help-smalltalk] [PATCH] Backwards-incompatible tweak to #on:do: with re

From: Paolo Bonzini
Subject: [Help-smalltalk] [PATCH] Backwards-incompatible tweak to #on:do: with resumable exceptions
Date: Mon, 25 Feb 2008 10:30:10 +0100
User-agent: Thunderbird (Macintosh/20071031)

This makes #on:do: fully ANSI compliant by ensuring that falling off an exception handler will *always* leave the #on:do: block. The previous behavior was to resume for resumable exceptions and return for non-resumable exceptions.

The previous behavior of GNU Smalltalk was implemented also by Visual Smalltalk Express (VSE), the very source of the ANSI standard exception mechanism. The VSE and GST behavior was by design meant to "do the right thing" in various default situations: the "right thing" for a resumable exception whose handler "returned normally" (ran of the end of the block) was to resume while the "right thing" for a non-resumable exception was to return.

Citing Allen Wirfs-Brock, the ANSI group "ultimately [decided] requiring that the user always explicitly request resumption would result in fewer subtle bugs.".

BTW, this change is necessary for Seaside, which relies on this in its implementation of #call:/#answer (not that it wouldn't be possible to patch Seaside instead -- but this is arguably a bug).

Note to self: try to understand what happens for other dialects when the default handler is reached with #pass. Should the exception resume or return?

diff --git a/ChangeLog b/ChangeLog
index 3f1e5c0..2c9ce9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-25  Paolo Bonzini  <address@hidden>
+       * kernel/ Upon executing off the end of an
+       exception handler, always return from the associated #on:do:.
 2008-02-22  Paolo Bonzini  <address@hidden>
        * kernel/ Add #date:time:offset:, #date:time:.
diff --git a/NEWS b/NEWS
index 1930c0f..2221fce 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,11 @@ o   ObjectMemory>>#snapshot and ObjectMemory>>#snapshot: 
return false in
     snapshot.  Note that this does not apply to CallinProcesses, since
     those are stopped in saved images (will this be true in 3.1?).
+o   The semantics of #on:do: were changed: executing off the end of an
+    exception handler will always return from the associated #on:do:.
+    Older versions of GNU Smalltalk either returned or resumed depending
+    on the resumability of the exception.
 o   New tool gst-remote allows remote control of a GNU Smalltalk VM
     via a TCP socket.
diff --git a/kernel/ b/kernel/
index 8e45f44..4b71afd 100644
--- a/kernel/
+++ b/kernel/
@@ -213,7 +213,7 @@ CoreException, so the two mechanisms are actually 
        <category: 'exception signaling'>
        self exception instantiateNextHandler: self.
-       ^self activateHandler: self isResumable
+       ^self activateHandler: (onDoBlock isNil and: [ self isResumable ])
     signal: messageText [

reply via email to

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