[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12216: peek-char incorrectly *CONSUMES* eof
From: |
David A. Wheeler |
Subject: |
bug#12216: peek-char incorrectly *CONSUMES* eof |
Date: |
Tue, 05 Mar 2013 14:17:31 -0500 (EST) |
I reported:
> > Guile's peek-char has a bug; it incorrectly *consumes* eof instead of
> > just reporting it.
Andy Wingo replied:
> I have the feeling that for interactive use, if you expect to read a EOF
> from a port and then continue, you have to not use peek-char. You need
> to handle your own lookahead buffer. I know it's not a great answer,
> but I can't think of anything else that makes sense.
We don't want to read an EOF and then continue.
We peek-char to not *CONSUME* an interactive EOF.
Once peek-char returns EOF, every following peek-char
should *also* return EOF until the EOF is read.
That isn't what currently happens.
E.G.:
(define (demo) (write (peek-char)) (write (peek-char)))
(demo)
; Now type control-D ENTER.
; It SHOULD produce #<eof> twice, after peeking EOF,
; but instead it produces #<eof> #\newline
#<eof>#<eof>guile> (demo)
--- David A. Wheeler
- bug#12216: peek-char incorrectly *CONSUMES* eof, Andy Wingo, 2013/03/05
- bug#12216: peek-char incorrectly *CONSUMES* eof,
David A. Wheeler <=
- bug#12216: peek-char incorrectly *CONSUMES* eof, Andy Wingo, 2013/03/07
- bug#12216: peek-char incorrectly *CONSUMES* eof, Daniel Hartwig, 2013/03/08
- bug#12216: peek-char incorrectly *CONSUMES* eof, David A. Wheeler, 2013/03/09
- bug#12216: peek-char incorrectly *CONSUMES* eof, Daniel Hartwig, 2013/03/09
- bug#12216: peek-char incorrectly *CONSUMES* eof, Andy Wingo, 2013/03/13
- bug#12216: peek-char incorrectly *CONSUMES* eof, David A. Wheeler, 2013/03/13
- bug#12216: peek-char incorrectly *CONSUMES* eof, Andy Wingo, 2013/03/13
- bug#12216: peek-char incorrectly *CONSUMES* eof, Mark H Weaver, 2013/03/13
- bug#12216: peek-char incorrectly *CONSUMES* eof, Andy Wingo, 2013/03/13
- bug#12216: peek-char incorrectly *CONSUMES* eof, Mark H Weaver, 2013/03/14