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

[no subject]

The subtlety you are missing (and which I admit may never
have been properly documented) is that IN is a type FIXNUM
function.  This implies that it can return ONLY fixnum values.
On EOF, it follows the same convention as TYI, namely that
EOF returns a -1 value instead of the standard NIL value (this
has been documented, I am sure).  Even if you explicitly
specify an EOF value of NIL, both IN and TYI will "coerce"
this NIL to be a -1.
Unfortunately, unlike TYI, IN is capable of returning any fixnum
whatsoever as a valid result, so -1 cannot serve as a unique flag.
Therefore, because of the constarints on its valid domain and its total
domain, there can be no special distinguished EOF value.  It follows
that the THROW trick is in fact the only way to win.
Now perhaps in NIL the use of multiple-return values could provide an
alternative technique, as could the use of continuations (though the latter
would probably be somewhat slower).