Hmm, do we need to specifically say using eq? to check equality of comparators?  In Gauche, (equal? <comparator> <compartor>) returns #t when the content of comparators match, even they are not eq? to each other.  And the default comparator uses equal? for comparators.
(The logic is that comparatos are immutable objects, so if their slot values are eq? to each other there's no point to distinguish two comparator instances that allocated separately.)

For the portability it would be safe to precisely specify the equality predicate, but would there be a harm if we leave it to implementations as some sensible equality predicate? 


On Thu, Jul 20, 2017 at 4:23 AM, Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
Please review the changes here: https://github.com/mnieper/srfi-146

--

Marc

Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> schrieb am Do., 20. Juli 2017 um 15:58 Uhr:
Shiro Kawai <xxxxxx@gmail.com> schrieb am Di., 18. Juli 2017 um 13:29 Uhr:
For the scope of srfi-146, an implementation can compare given mappings' comparators directly by its own specific way, so I'm not sure it's worth to involve srfi-128.  How about something like this:

When {mappings|hashmaps} with different comparators are compared, it is an error if the implementation doesn't provide {an ordering predicate|a hash function} for comparators.  If an implementation's default comparator can {order|hash} comparators, it is used for {ordering mappings|hashing hashmaps}.  When ordering mappings, they are ordered first by their comparators, then within each group of shared comparators, they are ordered lexicographically with respect to the keys.  If an implementation's default comparator doesn't handle comparators, an impelentation of srfi-146 may still provide its own ordering of comparators.


I think, we have to be a bit more careful here. The default comparator implementation of SRFI 128 does actually supports comparators. But the equality predicate is trivial. So, we would have to ask whether the default comparator uses eq? for equality of comparators.

But then, it would work.

Shiro Kawai <xxxxxx@gmail.com> schrieb am Di., 18. Juli 2017 um 20:50 Uhr:
Right.  What I specifically request is a guarantee that this works for mappings A and B which doesn't share the comparator (and returns #f in that case):

   (=? mapping-comparator A B)

When we agree on "eq?" above, it makes sense to demand that "=?" always returns "#f" if A and B do not share the same comparator. And this has nothing to do with whether the implementation can order comparators using "eq?" as the equality or not, but can be portably implemented.

Marc