[plt-scheme] no #!eof

From: Jos Koot (jos.koot at telefonica.net)
Date: Tue Apr 15 08:20:28 EDT 2008

Having followed this thread my two cents:

On old tape systems we had multiple files.
For a labeled tape it worked right.
On an unlabeled tape it was a dissastre.
Why?
Because the labels build an extra layer and are not part of the data
(unless you read a labeld tape as though not labeld,
what I did many times to repair damaged tapes (long ago:-))

An eof, if it is indeed meaning *end of file*, must not be a character, of 
course. The eof object is not a character either.
It is a level higher than characters, a signal saying: `sorry, there is 
nothing more to be read'
This does not mean that there cannot be such thing as a symbolic literal for 
eof say `*eof'.
`*eof' is not an end of file: it has the meaning of `end of file marker hit'
Just like `0' is not a number, but has the meaning of a number (the number 
being self evaluating, but `0' itself is not self evaluating)
Just like `(lambda (x) x)' is not a procedure but a sexpr whose value is a 
procedure (and the procedure being self evaluating)
Just like `(read (open-input-string ""))' is not an eof but has the value 
which we call the eof-object.
Even the eof-object is not an eof, it is a first class datum.
Like Q Quinn already said: `make distinction between different levels of 
quotation' (my paraphrase)

This said it seems possible to me to allow
(case (readchar some-port)
 ((*eof) "end of file hit")
 (else etc.))
without `*eof' *being* an end of file, i.e.
without the danger that the syntax reader will halt reading when 
encountering `*eof'.
And without the danger that (write *eof) writes an end of file, but rather 
the text `#<eof>'.
`*eof' is just a word of four characters.
It should be impossible to *write* an end of file.
Create an end of file by closing the output port.

Sorry for my peremptory tone. Nevertheless a humble opinion.
Jos





Posted on the users mailing list.