Attempting to use exception handling, but running into trouble

This commit is contained in:
Justin Ethier 2015-03-20 14:39:23 -04:00
parent 41c458c23f
commit 15094f6d03

View file

@ -8,12 +8,23 @@
(cyclone (cyclone
(display *Cyc-version-banner*)) (display *Cyc-version-banner*))
(else #f)) (else #f))
;; TODO: define repl iteration, and wrap in an exception handler
(define (repl:next-line)
(with-exception-handler
(lambda (obj)
(write (list 'an-error-occurred obj)))
(lambda ()
(repl))))
(define (repl) (define (repl)
(display "cyclone> ") (display "cyclone> ")
(let ((c (eval (read)))) (let ((c (eval (read))))
(cond (cond
((not (eof-object? c)) ((not (eof-object? c))
(write c) (write c)
(repl)) (repl:next-line))
(else #f)))) (else #f))))
(repl)
(repl:next-line)