[R6RS] `eqv?' on immutable records

R. Kent Dybvig dyb at cs.indiana.edu
Mon May 14 16:45:15 EDT 2007


> > Incidentally, I'm guilty of defining record types with no fields to be
> > used only for their object identity, e.g., defining
> > 
> >   (define-record-type label)
> > 
> > and counting on each call to make-label returning a new object
> > distinguishable from all others via eq?.
>
> That strikes me as the moral equivalent of counting
> on each call to list or vector or string to return
> a new object that's distinguishable (via eq?) from
> the results of all other calls to list or vector or
> string.
>
> In other words, code that does that seems just plain
> buggy to me.  I don't think the R6RS is obliged to
> convert buggy R5RS code into correct R6RS code, or
> to convert buggy R5RS+records code into correct R6RS
> code.

"moral equivalent"?  Are we now reduced to language fanaticism? :-)

I assume you're talking about (list), (string), and (vector), right?  If
you're talking about calls to these procedures with one or more arguments,
don't both r5rs and r6rs require location tags for the resulting
structures?

If you are talking just about (list), (string), and (vector), I agree that
the situation for record types with no fields is somewhat analogous.  Yet
my first choice would still be to give instances of such types a location
tag and allow implementations to optimize it away only if the instances
can never be tested with eq?.  My second choice would be to require all
instances of the type to be eq?, as with the object returned by (list). 
Allowing this to go either way, at the whim of the implementation, is no
favor to the programmer.

Kent



More information about the R6RS mailing list