[gambit-list] [PATCH] Make unclean exception handling clean again

Christian Jaeger christian at pflanze.mine.nu
Thu Nov 27 08:08:01 EST 2008

After breakfast I realize that the "cleanness" the routine is
referring to was probably not the stripping of continuation frames
from the sight of the user, but the calling of (release-ownership!).

Now how to fix this? The approach in this patch is to run
(release-ownership!) in the repl-context as did the old code, but then
run the original handler in the context of the error; well this means
that we will be in a repl while ownership has been released, dunno if
that's a good thing.

Possibly an alternative might be using |dynamic-wind| instead? I don't
know what the onwership exactly implies.

Signed-off-by: Christian Jaeger <christian at pflanze.mine.nu>
 Apply on top of the previous patch. As usual with "git am -3 emailfile"

 lib/_repl.scm |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/lib/_repl.scm b/lib/_repl.scm
index fe41fb6..9765661 100644
--- a/lib/_repl.scm
+++ b/lib/_repl.scm
@@ -2291,7 +2291,16 @@
 	      (lambda ()
 		(macro-raise exc)))
-	     (old-handler exc)))
+	     (continuation-capture
+	      (lambda (cont)
+		(##continuation-graft
+		 (macro-repl-context-cont repl-context)
+		 (lambda ()
+		   (release-ownership!)
+		   (##continuation-graft
+		    cont
+		    (lambda ()
+		      (old-handler exc)))))))))
   (define (acquire-ownership!)

More information about the Gambit-list mailing list