aboutsummaryrefslogtreecommitdiff
path: root/module/hnh
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-10-16 22:10:18 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-10-16 23:28:34 +0200
commit377171cfe46aae3b27ad6221adbf4521359c2d52 (patch)
tree8df4f004ea227a93ae1837631d350036679aded8 /module/hnh
parentFix wrongly ordered TODO's. (diff)
downloadcalp-377171cfe46aae3b27ad6221adbf4521359c2d52.tar.gz
calp-377171cfe46aae3b27ad6221adbf4521359c2d52.tar.xz
Extend catch to allow pre-unwind handlers.
Diffstat (limited to 'module/hnh')
-rw-r--r--module/hnh/util.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/module/hnh/util.scm b/module/hnh/util.scm
index bd38a445..929f23a0 100644
--- a/module/hnh/util.scm
+++ b/module/hnh/util.scm
@@ -538,9 +538,12 @@
(define-syntax catch*
- (syntax-rules ()
+ (syntax-rules (pre-unwind)
+ ((_ thunk ((pre-unwind key) handler))
+ (with-throw-handler (quote key) thunk handler))
((_ thunk (key handler))
(catch (quote key) thunk handler))
- ((_ thunk (key handler) rest ...)
- (catch* (lambda () (catch (quote key) thunk handler))
+
+ ((_ thunk pair rest ...)
+ (catch* (lambda () (catch* thunk pair))
rest ...))))