[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On talking with Bill Rozas about EQV?, I think I should clarify my
position, in order to help people understand it. I haven't been very
Suppose that X and Y are expressions which evaluate to procedures or
numbers. Then I want the following two rules to hold.
(A) If (EQ? X Y) returns true, then the values of X and Y have the same
meaning with respect to all operations, including
implementation-dependent ones. (Note that the converse is not
true. I think we all agree about this rule.)
(B) If (EQV? X Y) is defined, then it should return true or false
depending on whether or not the values of X and Y have the same
meaning with respect to all implementation-independent Scheme
operations. If not, then implementations may choose to take any
action appropriate to situations that "are errors": return true,
false, or some other value, or signal an error, or do something
else. (So far everyone has disagreed with me about this.)
Thus (EQ? X Y) implies (EQV? X Y) whenever (EQV? X Y) is defined.
Also, since the only thing you can do with a procedure is call it, then
EQV? on two procedures would have to determine whether two procedures do
the same thing, which is in general impossible. So in order for rule
(B) to hold, if X and Y are both procedures, then (EQV? X Y) must be
I want to be able to use EQ? to do things like caching (memoization);
some implementations may choose to invariably return false when given
two procedures, but if they return true sometimes (subject to rule A)
then my programs might run faster. If I want to convince myself that my
program which uses EQ? is portable, I may have to do some rather
sophisticated reasoning, allowing for the fact that results may be
On the other hand, I want to know that if my program which uses EQV?
never passes two procedures to EQV?, and is otherwise in no way
implementation-sensitive, then I can have complete confidence that it
will run the same way in any correct Scheme implementation. In
particular, if I convince myself that the program works in my
implementation (by testing it or using any other technique), then I will
have no trouble convincing myself that it will work when run by any
The set of implementation-independent primitives is already pretty
large, and I want to include EQV? in that set, to permit very naive
portability criteria (like "EQ? doesn't occur").
I DON'T want programs which use EQV? to gratuitously work just because I
happen to be using some particular implementation. I might fool myself
into thinking the program will work in others. So I want to allow my
implementation to signal an error.
[I guess my criterion (B) is pretty strong. I hope that this doesn't
precipitate a discussion of the meaning of QUOTE. Please don't even
think about mentioning that, before we get this issue straightened out.]
Sorry to be long-winded. Please either shoot me down or bear with.