fix else handling for R6RS 'guard'
svn: r9155
This commit is contained in:
parent
3801bca204
commit
7a41c7ddd6
|
@ -56,16 +56,25 @@
|
||||||
(exn:continuable-continuation exn)))
|
(exn:continuable-continuation exn)))
|
||||||
|
|
||||||
(define-syntax-rule (guard (id cond-clause ...) body0 body ...)
|
(define-syntax-rule (guard (id cond-clause ...) body0 body ...)
|
||||||
(with-handlers ([(lambda (x) #t)
|
(with-handlers* ([(lambda (x) #t)
|
||||||
(lambda (id)
|
(lambda (id)
|
||||||
(let ([id (if (exn:continuable? id)
|
(let ([id (if (exn:continuable? id)
|
||||||
(exn:continuable-base id)
|
(exn:continuable-base id)
|
||||||
id)])
|
id)])
|
||||||
(cond
|
(exn-cond id
|
||||||
cond-clause ...
|
cond-clause ...)))])
|
||||||
[else (raise id)])))])
|
|
||||||
body0 body ...))
|
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)
|
(define (r6rs:raise exn)
|
||||||
;; No barrier
|
;; No barrier
|
||||||
(raise exn #f))
|
(raise exn #f))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user