[plt-scheme] no #!eof
On Apr 15, Abdulaziz Ghuloum wrote:
>
> On Apr 15, 2008, at 1:06 AM, Eli Barzilay wrote:
>
> > What about:
> >
> >> (read)
> > (
> > 1
> > ^D
> > 2
> > )
> >
> > At least in the old version of Chez I get
> >
> > Error in read: unexpected end-of-file.
> >
> > right after the ^D, but I get (1 #!eof 2) if I use `#!eof' instead of
> > ^D.
>
> Right. This is because, as Matthew said, "a reader can treat an eof
> in the character stream as different from a representation of a
> literal eof."
(Right.)
> Read returns an eof if the first thing it sees is a ^D, but signals
> an error if it sees a ^D while trying to parse a datum (e.g., if you
> try to read from the string "(", you get an error since there is a
> "character stream" eof after the left parenthesis). Read doesn't
> signal an error for the eof objects it constructs itself since there
> is no "character stream" eof in #!eof.
(And that difference between #!eof and a "character stream eof" is the
part that is asking for trouble...)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!