[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] eq? and eqv? for records



On Mon, Feb 17, 2014 at 5:01 PM, John Cowan <cowan@x> wrote:
Taylan Ulrich Bayırlı/Kammer scripsit:

> The `eqv?' definition says that records are equivalent if denoting the
> same location and points to section 3.4, which explains that the notion
> of "storage being newly allocated" is what denotes the creation of
> objects with distinct locations, yet section 5.5 (<constructor name>
> point) doesn't use that phrase.  In short, we base record equivalence
> semantics on their location, yet don't specify their location.

But 5.5 does say that each field of a record is a location.  True,
it doesn't say a _distinct_ location, but I think that can be safely
inferred.

Considering how much time we spent debating various aspects
of eqv?, I wouldn't say anything is "safe to infer" here :)
But let's assume it is for the sake of argument.

>From that, it follows that records of a non-empty type
are different in the sense of `eqv?` iff they are created by distinct
constructor invocations.

This logic contains two questionable assumptions.
First, that because record fields are locations the
records themselves are locations, which need not be
the case.  Second that the records themselves must
be _distinct_ locations.

For practical purposes, I believe in all existing
implementations the constructor allocates a new
record on each call.  Moreover, I believe this was
the intention of the phrase "new record" as taken
directly from SRFI 9.

On the other hand, I can see the desire to want to
be able to automatically intern immutable records
(e.g. consider dates), so it almost appears to be
a feature that this is left unspecified.  At the very
least it bears more discussion.

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports