summaryrefslogtreecommitdiff
path: root/module/rnrs
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2020-01-10 21:42:26 +0100
committerAndy Wingo <wingo@pobox.com>2020-01-10 21:42:26 +0100
commit8068994ba859e2a81830b2bd7e71c002e3a79700 (patch)
tree1c237bbc52f9c2dda2283e265f8d38b564e3fc48 /module/rnrs
parent9f2b70310151388791638bf1b7fe8b5237516376 (diff)
downloadguile-8068994ba859e2a81830b2bd7e71c002e3a79700.tar.gz
Re-implement `guard'
* module/ice-9/exceptions.scm (guard): Add guard definition that re-propagates from original continuation, runs consequents in tail position in guard continuation, and doesn't rewind the stack. * module/srfi/srfi-34.scm: * module/rnrs/exceptions.scm (guard): Re-export from (ice-9 exceptions).
Diffstat (limited to 'module/rnrs')
-rw-r--r--module/rnrs/exceptions.scm20
1 files changed, 2 insertions, 18 deletions
diff --git a/module/rnrs/exceptions.scm b/module/rnrs/exceptions.scm
index 68797b27f..862a0f7dc 100644
--- a/module/rnrs/exceptions.scm
+++ b/module/rnrs/exceptions.scm
@@ -1,6 +1,6 @@
;;; exceptions.scm --- The R6RS exceptions library
-;; Copyright (C) 2010, 2011, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2010, 2011, 2013, 2020 Free Software Foundation, Inc.
;;
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -23,20 +23,4 @@
(rnrs control (6))
(rnrs conditions (6))
(rename (ice-9 exceptions)
- (raise-exception raise)))
-
- (define-syntax guard0
- (syntax-rules ()
- ((_ (variable cond-clause ...) . body)
- (call/cc (lambda (continuation)
- (with-exception-handler
- (lambda (variable)
- (continuation (cond cond-clause ...)))
- (lambda () . body)))))))
-
- (define-syntax guard
- (syntax-rules (else)
- ((_ (variable cond-clause ... . ((else else-clause ...))) . body)
- (guard0 (variable cond-clause ... (else else-clause ...)) . body))
- ((_ (variable cond-clause ...) . body)
- (guard0 (variable cond-clause ... (else (raise variable))) . body)))))
+ (raise-exception raise))))