Alaric Snell-Pym wrote:

> Correct me if I'm wrong, but isn't this more an argument about whether
> procedures need to be reified as first-class objects "in practice" (as
> well as just "in effect"), rather than purely about EQV?

No.  This has absolutely nothing to do with whether procedures are
first-class objects, and everything to do with the semantics of one
particular equivalence predicate (eqv?).  (To be more accurate:  As
mentioned below, it has to do with the semantics of *two* particular
equivalence predicates.)

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.

> If a procedure is reified as a closure object, I gather we can easily
> answer (eqv? x y) as #t if the closure has the same code vector and the
> same closed-over values (identical, not just same-valued, to allow for
> mutation, which is trivially #t if there are no closed-over values), and
> "maybe, can't tell" (spelt #f) if not.

That behavior (for eqv?) appears to be allowed by both the R5RS and
the R6RS semantics.

I have just changed the development version of Larceny/IA32 to implement
that semantics, and I believe that implementing this change in all
versions of Larceny will allow me to improve its compiler without
violating the R5RS semantics of eqv?.

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?.

At this point, I'm inclined to violate both the R5RS and R6RS semantics
by implementing the semantics Alaric Snell-Pym suggested above for eqv?
but not for eq?.

I would be interested in seeing any real-world examples of correct
R6RS code that wouldn't work with that non-conforming implementation.

Will

_______________________________________________
r6rs-discuss mailing list
r6rs-discuss@lists.r6rs.org
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to