Menu

#74 Reading from Terminal includes the first line

General
closed-fixed
nobody
bugs (1)
5
2015-07-15
2015-07-05
No

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.

Discussion

  • Shiro Kawai

    Shiro Kawai - 2015-07-05

    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.

     
  • Shiro Kawai

    Shiro Kawai - 2015-07-15
    • status: open --> closed-fixed
     

Log in to post a comment.