[plt-scheme] no #!eof
On Mon, Apr 14, 2008 at 10:39:51PM -0400, Abdulaziz Ghuloum wrote:
> On Apr 14, 2008, at 7:37 PM, Joe Marshall wrote:
> >If EOF has a printed representation, what is the reader to do if
> >it encounters it in a file?
>
> Producing an eof object is reasonable, like the one obtained by
> calling R6RS's (eof-object).
>
> E.g.,
> > (read (open-string-input-port "#!eof"))
> #!eof
> > (eof-object? (read (open-string-input-port "#!eof")))
> #t
>
> >If I write the EOF object to a file, can I write anything after it?
>
> Why not? The first call to read will return an eof object while a
> second call to read will read what comes after it.
>
> E.g.,
> > (let ([p (open-string-input-port "12 #!eof 13")])
> (list (read p) (read p) (read p)))
> (12 #!eof 13) ;;; in some unspecified order
Ew! Yuck! If you do that, then in what sense is it a marker of the end
of the file? And if it isn't the marker of the end of the file, what use
is it at all?
Cheers,
--
Andrew