mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Improving error handling
This commit is contained in:
parent
94802939c0
commit
701b423edd
1 changed files with 11 additions and 12 deletions
23
icyc.scm
23
icyc.scm
|
@ -9,22 +9,19 @@
|
||||||
(display *Cyc-version-banner*))
|
(display *Cyc-version-banner*))
|
||||||
(else #f))
|
(else #f))
|
||||||
|
|
||||||
;; TODO: define repl iteration, and wrap in an exception handler
|
|
||||||
|
|
||||||
; TODO: the below is broken because CPS conversion replaces it with:
|
|
||||||
;
|
|
||||||
; ((lambda (call/cc)
|
|
||||||
; (define repl:next-line
|
|
||||||
;
|
|
||||||
; So repl:next-line is never defined as a global!
|
|
||||||
; We need a better solution
|
|
||||||
|
|
||||||
(define (repl:next-line)
|
(define (repl:next-line)
|
||||||
(call/cc
|
(call/cc
|
||||||
(lambda (k)
|
(lambda (k)
|
||||||
(with-exception-handler
|
(with-exception-handler
|
||||||
(lambda (obj)
|
(lambda (obj)
|
||||||
(write (list 'an-error-occurred obj))
|
(display "Error: ")
|
||||||
|
(write obj)
|
||||||
|
; TODO:
|
||||||
|
;(for-each
|
||||||
|
; (lambda (o)
|
||||||
|
; (display o)
|
||||||
|
; (display " "))
|
||||||
|
; obj)
|
||||||
(k #t))
|
(k #t))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(repl)))))
|
(repl)))))
|
||||||
|
@ -37,6 +34,8 @@
|
||||||
((not (eof-object? c))
|
((not (eof-object? c))
|
||||||
(write c)
|
(write c)
|
||||||
(repl:next-line))
|
(repl:next-line))
|
||||||
(else #f))))
|
(else
|
||||||
|
(exit 0) ;; TODO: crashes on this branch... WTF?
|
||||||
|
))))
|
||||||
|
|
||||||
(repl:next-line)
|
(repl:next-line)
|
||||||
|
|
Loading…
Add table
Reference in a new issue