Hi, Marc.  Would you mind taking on this question?

Thanks.

---------- Forwarded message ---------
From: Sudarshan S Chawathe <xxxxxx@eip10.org>
Date: Mon, Mar 23, 2020 at 10:30 AM
Subject: SRFI 146: comparator equality and a test in sample implementation
To: <xxxxxx@srfi.schemers.org>


One of the tests included in the SRFI 146 sample implementation (line
364 of test.sld, excerpted below) seems to imply required inequality of
two comparators (and thus mappings with those) that have the same four
component procedures (type test, equality, ordering, hash).  I may be
missing something obvious but I cannot find that requirement in either
SRFI 146 or SRFI 128.

Further, a quick check with Chibi Scheme seems to support the
possibility of such comparators being equal:

  (import (scheme base)
          (scheme write)
          (srfi 128))

  (write
   (let ((c (make-default-comparator)))
     (list (equal? c c)
           (equal? c (make-comparator (comparator-type-test-predicate c)
                                      (comparator-equality-predicate c)
                                      (comparator-ordering-predicate c)
                                      (comparator-hash-function c))))))
  (newline)

prints:

  (#t #t)

which makes sense to me, but seems to contradict the above-mentioned
test.

I would be grateful if someone can clarify the situation.

Here is the test in question, for easy reference:

  (test-group "Submappings"
    (define mapping1 (mapping comparator 'a 1 'b 2 'c 3))
    (define mapping2 (mapping comparator 'a 1 'b 2 'c 3))
    (define mapping3 (mapping comparator 'a 1 'c 3))
    (define mapping4 (mapping comparator 'a 1 'c 3 'd 4))
    (define mapping5 (mapping comparator 'a 1 'b 2 'c 6))
    (define mapping6 (mapping (make-comparator (comparator-type-test-predicate comparator)
                                               (comparator-equality-predicate comparator)
                                               (comparator-ordering-predicate comparator)
                                               (comparator-hash-function comparator))
                              'a 1 'b 2 'c 3))

    ;; other tests omitted

    (test-assert "mapping=?: different comparators"
      (not (mapping=? comparator mapping1 mapping6)))

    ;; other tests omitted

    )


Regards,

-chaw