[r6rs-discuss] Why is (eqv? g g) unspecified when g is a procedure?
cowan at mercury.ccil.org
Tue Jul 17 16:19:02 EDT 2012
will at ccs.neu.edu scripsit:
> Those who have been claiming this has to do with whether procedures
> are first-class objects are probably unfamiliar with the history of
> that phrase and with its usage in other language communities. If
> you tried to argue that functions aren't first class in Standard ML,
> for example, SML programmers would think you've lost your marbles,
> but (IIRC) SML doesn't define equality on functions at all.
Different definitions for different contexts. SML equality has ad-hoc
polymorphism; Scheme `eqv?` has universal polymorphism. In SML, almost
everything is immutable, and Leibniz's criterion doesn't apply. In
pre-R6RS Scheme, almost everything is mutable, and Leibniz's criterion
is all we have to work with.
> Unfortunately, both the R5RS and the R6RS require eq? to behave the
> same as eqv? on procedures. With the semantics you have suggested
> and I have implemented, that cannot be done without making eq? too
> complicated to inline, which defeats the whole purpose of eq?.
"Too complicated" is meaningful only with respect to a given
implementation. Plain Chicken, for example, has immediate characters
and fixnum/flonum arithmetic, so `eqv?` is just a pointer test, two type
tests, and a floating-point equality test.
MEET US AT POINT ORANGE AT MIDNIGHT BRING YOUR DUCK OR PREPARE TO FACE WUGGUMS
John Cowan cowan at ccil.org http://www.ccil.org/~cowan
More information about the r6rs-discuss