[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

EOF-VALUE



    Date: Sat, 25 Jul 87 19:53 EDT
    From: MURRAY%cs.umass.edu@relay.cs.net

[...]

    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?

While I admit that it is common, it is not foolproof, because someone
can type #.*eof-value*.  The only really safe eof value is an object
consed on the fly, as in

	(let ((eof-value (ncons '*eof-value*)))	;self-documenting structure
	  ...
	  (read *standard-input* nil eof-value)
	  ...)

The only way one could get at that value is by using a debugger or some
other internal hack to look in the lexical environment, and they don't
count.

However, I wouldn't object strongly to adding *eof-value*, as anyone who
types #.*eof-value* deserves what they get.

                                                barmar