[plt-scheme] When does eqv? differ from eq? , from equal?

From: Ernie Smith (esmith at acanac.net)
Date: Tue Oct 7 14:29:32 EDT 2008

Marco Morazan wrote:
>
>> (eq? 10000000000 10000000000)
>>     
> false
>
> It only makes sense if we think about pointers and that seems
> unfortunate, but maybe you can present evidence that makes this a
> necessary compromise. Does the comparison of two registers in constant
> time provide us with significantly superior performance over what eqv?
> must do for typical applications?
>
>   
Your point is a good argument against the choice of names for eq? .
eq? is indeed an unfortunate choice of names. 
But if we can tolerate car and cdr,  we can probably tolerate eq?

I do disagree with the rest of your assertion.
eq? certainly does not evoke thoughts of  pointers, not at all,
not even in me,  a refugee C programmer to whom the term 'pointer'
evokes precise meaning.

I think you'd be a little harder pressed to argue in favor of outlawing 
an identity function?
Without one, before long, we'd all be shooting ourselves in the foot.

That is the notion of sameness that eq? evokes in me. 
I'd be sorry to see it go.

Not of the same value,  not of equivalent value, but are they the same one?
No pointers involved. 

Achieve it by assigning a unique signature to each object and testing those
signatures for value equivalence if you like. 
Only then is the notion of pointer evoked in me,
as I think to myself,  that's probably sub-optimal implementation since 
he likely already has
a value with the necessary properties, the item's location.  And because 
I'm an old C
programmer, the location concept evokes pointer.

regards


Posted on the users mailing list.