mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-07 05:06:36 +02:00
Stubs for (raise-continuable)
This commit is contained in:
parent
b36640afda
commit
b55077ae1d
2 changed files with 17 additions and 2 deletions
18
test.scm
18
test.scm
|
@ -23,8 +23,22 @@
|
||||||
;(eval '(a 1))
|
;(eval '(a 1))
|
||||||
;(eval '(begin (define (a z) z) (a 1) (a 1)))
|
;(eval '(begin (define (a z) z) (a 1) (a 1)))
|
||||||
|
|
||||||
;(Cyc-add-exception-handler (lambda (err) (write 'new-ex-handler)))
|
|
||||||
;(Cyc-remove-exception-handler)
|
(write
|
||||||
|
(with-exception-handler
|
||||||
|
(lambda (con)
|
||||||
|
(cond
|
||||||
|
((string? con)
|
||||||
|
(display con))
|
||||||
|
(else
|
||||||
|
(display "a warning has been issued")))
|
||||||
|
42)
|
||||||
|
(lambda ()
|
||||||
|
(+ (raise-continuable "should be a number")
|
||||||
|
23))))
|
||||||
|
;prints: should be a number
|
||||||
|
;=> 65
|
||||||
|
|
||||||
(write
|
(write
|
||||||
(call/cc
|
(call/cc
|
||||||
(lambda (k)
|
(lambda (k)
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
;; Unregister this handler since it is no longer needed
|
;; Unregister this handler since it is no longer needed
|
||||||
(Cyc-remove-exception-handler)
|
(Cyc-remove-exception-handler)
|
||||||
(handler obj) ;; Actual handler
|
(handler obj) ;; Actual handler
|
||||||
|
;; TODO: unless obj is continuable, then return above result:
|
||||||
(error "exception handler returned"))))
|
(error "exception handler returned"))))
|
||||||
;; TODO: cond-expand below, since it uses Cyc functions?
|
;; TODO: cond-expand below, since it uses Cyc functions?
|
||||||
;; probably no need since this is part of internal lib
|
;; probably no need since this is part of internal lib
|
||||||
|
|
Loading…
Add table
Reference in a new issue