[R6RS] R6RS records: record equality

William D Clinger will
Fri Aug 26 16:22:25 EDT 2005


Marc wrote:
> But doesn't that mean that (eqv? r1 r2) is not a pointer
> comparison,

No, it does not mean that.  On the other hand, I don't know
of any implementations of R5RS Scheme in which eqv? is just a
pointer comparison, even without records, so I'd be surprised
if eqv? were to be commonly implemented by a pointer comparison
in R6RS Scheme.

> and (eqv? r1 r2) is the only way to test portably
> that two records are the same?

Probably.  (I've read several drafts of the records SRFI,
and no longer recall what the latest one says about this.)

> So when does it make sense
> to use (eq? r1 r2) in portable code?

When the programmer knows that at least one of r1 and r2 is
of one of the small number of types for which eq? behaves
the same as eqv?: symbols, booleans, the empty list, pairs,
procedures, and non-empty vectors.  See R5RS Section 6.1.

Will


More information about the R6RS mailing list