From 377171cfe46aae3b27ad6221adbf4521359c2d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 16 Oct 2022 22:10:18 +0200 Subject: Extend catch to allow pre-unwind handlers. --- module/hnh/util.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'module') 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 ...)))) -- cgit v1.2.3