[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: MURRAY%cs.umass.edu@RELAY.CS.NET, common-lisp@SAIL.STANFORD.EDU
- Subject: EOF-VALUE
- From: Christopher Fry <cfry@OZ.AI.MIT.EDU>
- Date: Sun, 26 Jul 87 19:23 EDT
- In-reply-to: The message of 25 Jul 87 19:53 EDT from MURRAY%cs.umass.edu@RELAY.CS.NET
What is the default value of EOF-VALUE for all the read functions?
For example, READ takes (&Optional input-stream eof-error-p eof-value).
If only INPUT-STREAM and EOF-ERROR-P are supplied, and EOF-ERROR-P is non-nil,
CLtL says that the value of EOF-VALUE will be returned if an end-of-file
is found. Without any further specification, I must assume that it
defaults to NIL, which is the default default value for unsupplied &Optionals.
For READ-CHAR, and READ-BYTE, NIL is an impossible value, but for READ
and company, NIL is a perfectly reasonable return value.
Thus, it makes no sense to supply a non-nil second argument, but not the third.
In fact, the only safe value for EOF-VALUE in these cases is some
non-atomic object that could never be EQ to something read in.
For this reason, In just about every file that calls read, I've got something
like (Defconst *eof-value* (cons nil nil)), (maybe it's eof-value, or
si:eof-value, or sys:**eof-value**, I can never remember), so I can supply
and test for it as an EOF-VALUE.
I would like to suggest the addition of new constant, *eof-value*, that
is the default value for EOF-VALUE in all the read functions.
Every system using something like this, why not make it standard?
- Kelly Murray
I second this proposal. Make EOF processing easy!