[R6RS] R6RS records: record equality

William D Clinger will
Fri Aug 26 15:04:58 EDT 2005


Marc wrote:
> The specification indicates that two records are equal? iff they are
> eq? (except if they represent builtin types like pairs, vectors, etc).
> I object to the "equal? iff eq?" because it limits the use of records.
> I would prefer a recursive definition where (equal? r1 r2) is true iff
> r1 and r2 are of the same record type, and for each field, the contents
> of that field in r1 and r2 are equal?.

I believe this would make the equal? comparison for records
equivalent to testing the operational equivalence of finite
automata, which I think is probably exponential in the worst
case.  Alternatively, we could allow equal? to go into an
infinite loop when comparing records, as it sometimes does
when comparing pairs and vectors.

> Aside from that I don't understand the rationale for
> 
>    (eqv? r1 r2)  not implying  (eq? r1 r2)
> 
> What's the practical use for this?

This allows eq? to be implemented by a pointer comparison,
even in systems that support unboxed representations for
records.

The performance advantages of both techniques are well known.
Why force implementations to choose between them?

Will


More information about the R6RS mailing list