[plt-scheme] no #!eof
On Apr 15, 2008, at 12:18 AM, Andrew Reilly wrote:
>> 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?
Have you never seen an eof midstream? Well, I haven't invented the
concept. :-)
Watch:
Welcome to MzScheme v3.99.0.18 [3m], Copyright (c) 2004-2008 PLT
Scheme Inc.
> (list (read) (read) (read) (read))
^D
12
^D
13
(#<eof> 12 #<eof> 13)
An eof marks the end of one segment in an input stream. Reading
again gets you to the next segment, and so on. So, this behavior
makes reading #!eof in a stream consistent with reading a ^D in stream:
Ikarus Scheme version 0.0.3+ (revision 1450, build 2008-04-14)
Copyright (c) 2006-2008 Abdulaziz Ghuloum
> (list (read) (read) (read) (read))
^D
12
^D
13
(#!eof 12 #!eof 13)
> (list (read) (read) (read) (read))
#!eof
12
#!eof
13
(#!eof 12 #!eof 13)
Aziz,,,