Reading from Terminal includes the first line
R7RS Scheme scripting engine
Status: Beta
Brought to you by:
shirok
Hi, I am porting SRFI 49 to an R7RS library. During the porting process I discovered that Gauche has a problem reading in interactive use.
(read-line), (read-char), and (peek-char) start reading after the closing parenthesis. I would say the correct behavior is to wait until the first newline, then read that line.
It is counterintuitive, but it's simply a side effect of 'read' stops reading at the outermost close parenthesis. It's not trivial to determine what's the right behavior---what if there's a whitespaces after parenthesis? What if there's another S-expr following the first one?
Currently I'm improving REPL, including using a custom reader instead of just standard 'read'. I may be able to employ some ad-hoc heuristics to avoid typical confusion.
Fix pushed.
https://github.com/shirok/Gauche/commit/1fdc908a0ed78d97e5c691579c253a020bb764a1