From b55077ae1d27e5becaa788a27d8a72ef3d120459 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 19 Mar 2015 14:07:22 -0400 Subject: [PATCH] Stubs for (raise-continuable) --- test.scm | 18 ++++++++++++++++-- trans.scm | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/test.scm b/test.scm index c88871c3..a97c3116 100644 --- a/test.scm +++ b/test.scm @@ -23,8 +23,22 @@ ;(eval '(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 (call/cc (lambda (k) diff --git a/trans.scm b/trans.scm index 58bf5bf2..9645edfb 100644 --- a/trans.scm +++ b/trans.scm @@ -75,6 +75,7 @@ ;; Unregister this handler since it is no longer needed (Cyc-remove-exception-handler) (handler obj) ;; Actual handler + ;; TODO: unless obj is continuable, then return above result: (error "exception handler returned")))) ;; TODO: cond-expand below, since it uses Cyc functions? ;; probably no need since this is part of internal lib