[R6RS] non-opaque record equality

dyb at cs.indiana.edu dyb at cs.indiana.edu
Sat Feb 25 13:15:57 EST 2006

> Would it make sense for two records could be `equal?' when 
>  1. they are instances of the same *non-opaque* record type, and 
>  2. their corresponding field values are all `equal?'
> ? This change seems consistent with the SRFI's reflection support on
> non-opaque records.

I don't have any strong objections, but I wouldn't view it as a net
improvement.  For some uses of equal?, it would be good, for others bad.

I'm a little concerned what happens with objects like procedures,
ports, and hash tables that may or may not be implemented as records.
It seems like we might end up with an implementation dependency in the
behavior of equal? where such objects are concerned.

For example, we might have:

  (define (f)
    (let ([x (list '*)])
      (set-cdr! x x)
      (lambda () x)))

  (equal? (f) (f))      nonterminating if procedures are records,
                        #f otherwise

I suppose we could address this by defining precisely how equal? works
for the core types and for any new types we define in standard libraries,
although a similar issue could arise with non-standard libraries.


More information about the R6RS mailing list