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

EQ? and procedures, numbers, etc



RRRS says that (EQ? x x) is always true, but it would be better if the value
returned by EQ? were undefined when applied to procedure values and numbers.
The current wording of RRRS forces a formal semantics of Scheme to associate
locations with procedure values and numbers.  These locations have no
purpose other than to make the semantics of EQ? work as in RRRS, and they
make the semantics much uglier.

The ugliness of the semantics results in more complex and less effective
optimizing compilers.

I thought that it would be a cleaner semantics if (EQ? x x) always returned
true, but I was wrong.  It is actually a cleaner semantics if the value of
EQ? is unspecified when both its arguments are procedures and when both its
arguments are numbers.  When strings are immutable (as in the essential
subset of Scheme) EQ? should be unspecified when both its arguments are
strings.  Similarly EQ? should be unspecified when both its arguments are
characters (unless we want to insist that either (1) characters are
represented uniquely (e.g. immediates) or (2) EQ? does something
complicated).

Will Clinger