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
(display *Cyc-version-banner*))
(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)
(display "cyclone> ")
(let ((c (eval (read))))
(cond
((not (eof-object? c))
(write c)
(repl))
(repl:next-line))
(else #f))))
(repl)
(repl:next-line)