[R6RS] `eqv?' on immutable records

R. Kent Dybvig dyb at cs.indiana.edu
Mon May 14 11:11:38 EDT 2007


> > Mike wrote:
> >> > It was a mistake to tag immutable pairs, vectors, strings,
> >> > and especially procedures with a location....
> >>
> >> I agree with you.  Is anyone here against fixing this, at least for
> >> pairs, vectors, and strings?
> >
> > Kent apparently is.  With regard to the action of eqv?
> > on quoted constants, he wrote:
> >
> >> These can all be done while preserving eqv? for quoted constants.  The
> >> real question is whether we're going to allow naive implementations
> >> that don't preserve eqv? for quoted constants.
> >>
> >> I'd rather require them to preserve eqv? for quoted constants.

I think it's confusing if the immutability of a pair or other normally
mutable object has some effect on the behavior of eqv?.  Indeed, I prefer
that immutability of a pair or other normally mutable object affect only
whether portable programs are permitted to mutate it.  It's not a big deal
for a compiler that unboxes constants to (a) avoid doing so if a constant
can reach eqv?, (b) maintain both boxed and unboxed forms when necessary,
or (c) recover eqv?  semantics for unboxed constants by commonizing eq? 
substructures of constants in the final output.

The situtation with records is not analogous.  R6RS record types are
inherently mutable or inherently immutable: there's no way to create two
instances of the same record type, one of which is mutable and the other
of which is immutable.

Kent



More information about the R6RS mailing list