diff --git a/CHANGELOG.md b/CHANGELOG.md index 21fcec2e..3f69e477 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Features Bug Fixes - Arthur Maciel replaced high resolution code in the runtime to use `clock_gettime` instead of `gettimeofday`. +- Fixed the REPL to no longer automatically exit if an expression evaluates to EOF. However, the REPL will exit as a special case if the EOF character is entered directly, for example via CTRL-D on Linux. ## 0.27 - March 5, 2021 diff --git a/scheme/repl.sld b/scheme/repl.sld index fb148ca4..eed07c94 100644 --- a/scheme/repl.sld +++ b/scheme/repl.sld @@ -47,11 +47,12 @@ (newline) (repl)) (display "cyclone> ") - (let ((c (eval (read)))) - (cond - ((not (eof-object? c)) - (write c) - (newline) - (repl)) - (else - (display "\n")))))))) + (let ((obj (read))) + (if (eof-object? obj) + (newline) ;; Quick way to exit REPL + (let ((c (eval obj))) + (if (eof-object? c) + (display "") + (write c)) + (newline) + (repl))))))))