[R6RS] Constants vs. nullary procedures

William D Clinger will at ccs.neu.edu
Fri Jul 28 21:57:37 EDT 2006

Mike wrote:
> Naive question.

Not at all.

> I know this came up before in some conversation, but
> I forget what the answer was: What is the reason for providing things
> like eof-object and unspecified via nullary procedures rather than
> just the values themselves, given that bindings exported from
> libraries are immutable?

At this point, I think it's mostly a matter of tradition,
consistency, and backwards compatibility with tradition.

One minor point is that, although the R6RS will require 
there to be only one eof-object and only one unspecified
object, this uniqueness extends only to object identity
as determined by R6RS procedures.  An implementation
might have multiple eof-objects internally, perhaps to
distinguish eof on different ports, or perhaps to 
distinguish fake eof on Unix's interactive ports from
real eof on file or string ports, even though its eq?
procedure (and all other R6RS procedures) regards all
of those eof-objects as a single object.

In such an implementation, the programming environment
might derive some advantage from having the eof-object
procedure return internally distinguishable objects
each time it is called.

As you may recall, a similar issue arose with respect
to NaNs.  In some implementations, there may be only
one NaN; in others, there may be 47; in others, there
may be 2^53 or more.


More information about the R6RS mailing list