fix else handling for R6RS 'guard'

svn: r9155
This commit is contained in:
Matthew Flatt 2008-04-03 16:06:26 +00:00
parent 3801bca204
commit 7a41c7ddd6

View File

@ -56,16 +56,25 @@
(exn:continuable-continuation exn)))
(define-syntax-rule (guard (id cond-clause ...) body0 body ...)
(with-handlers ([(lambda (x) #t)
(with-handlers* ([(lambda (x) #t)
(lambda (id)
(let ([id (if (exn:continuable? id)
(exn:continuable-base id)
id)])
(cond
cond-clause ...
[else (raise id)])))])
(exn-cond id
cond-clause ...)))])
body0 body ...))
(define-syntax exn-cond
(syntax-rules (else)
[(_ id [else . rhs])
(cond [else . rhs])]
[(_ id clause . more)
(cond clause
[else (exn-cond id . more)])]
[(_ id)
(raise id)]))
(define (r6rs:raise exn)
;; No barrier
(raise exn #f))