mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Fixes for raise-continuable
This commit is contained in:
parent
1d5409b4ae
commit
8c8b7bff74
2 changed files with 7 additions and 5 deletions
4
test.scm
4
test.scm
|
@ -34,8 +34,8 @@
|
|||
(display "a warning has been issued")))
|
||||
42)
|
||||
(lambda ()
|
||||
(+ (raise-continuable "should be a number")
|
||||
23))))
|
||||
(+ (raise-continuable "should be a number") 23)
|
||||
)))
|
||||
;prints: should be a number
|
||||
;=> 65
|
||||
|
||||
|
|
|
@ -74,7 +74,8 @@
|
|||
(define (raise-continuable obj)
|
||||
((Cyc-current-exception-handler) (list 'continuable obj)))
|
||||
(define (with-exception-handler handler thunk)
|
||||
(let ((my-handler
|
||||
(let ((result #f)
|
||||
(my-handler
|
||||
(lambda (obj)
|
||||
(let ((result #f)
|
||||
(continuable? (and (pair? obj)
|
||||
|
@ -89,9 +90,10 @@
|
|||
;; TODO: cond-expand below, since it uses Cyc functions?
|
||||
;; probably no need since this is part of internal lib
|
||||
(Cyc-add-exception-handler my-handler)
|
||||
(thunk)
|
||||
(set! result (thunk))
|
||||
;; Only reached if no ex raised
|
||||
(Cyc-remove-exception-handler)))
|
||||
(Cyc-remove-exception-handler)
|
||||
result))
|
||||
))
|
||||
|
||||
;; Built-in macros
|
||||
|
|
Loading…
Add table
Reference in a new issue