On Sat, Nov 5, 2016 at 6:29 PM, Chris Hanson <c...@chris-hanson.org> wrote:

> I can understand why it acts that way, since two empty vectors are
> equivalent for all intents and purposes.
>
> Either way, eqv? and eqv-hash must agree, so one of them has to be changed.
>
> The eqv? of empty vectors seems to be false according to R7RS. Except that
> the section on eqv? is a little ambiguous around exactly this point, so
> maybe not.
>

The spec of eqv? is identical to the R5RS, except for the
equivalence of numbers which is based on the R6RS
(but fixing the broken wording of R6RS), to be a sort of
"operational equivalence" which distinguishes, e.g. +0.0
and -0.0.

For empty vectors, all three specs give the example:

  (eqv? '#() '#()) => <unspecified>

The specs all give special license for constants to make
it clear this is unspecified.  The definition of `vector' and
`make-vector' otherwise say they return "newly allocated"
vectors, suggesting false would be required, but the
discussion of storage model in section 3.4 of the R7RS
goes further to allow optimizing this case:

  [...] It is also understood that empty strings, empty vectors,
  and empty bytevectors, which contain no locations,
  may or may not be newly allocated.

-- 
Alex

On Fri, Nov 4, 2016 at 5:35 PM, Taylor R Campbell <campb...@mumble.net>
> wrote:
>
>> (let ((u (vector))
>>       (v (vector)))
>>   (list (list 'eq (eq? u v) (eq-hash u) (eq-hash v)
>>               (= (eq-hash u) (eq-hash v)))
>>         (list 'eqv (eqv? u v) (eqv-hash u) (eqv-hash v)
>>               (= (eqv-hash u) (eqv-hash v)))))
>> ;Value 15: ((eq #f 107689176 107689168 #f) (eqv #t 107689176 107689168
>> #f))
>>
>> Oops.
>>
>> Why do we treat empty vectors as eqv?  If we do, eqv-hash needs to be
>> made to agree.
>>
>> _______________________________________________
>> MIT-Scheme-devel mailing list
>> MIT-Scheme-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/mit-scheme-devel
>>
>
>
> _______________________________________________
> MIT-Scheme-devel mailing list
> MIT-Scheme-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/mit-scheme-devel
>
>
_______________________________________________
MIT-Scheme-devel mailing list
MIT-Scheme-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/mit-scheme-devel

Reply via email to