On Sun, Jan 13, 2019 at 8:33 AM Jéssica Milaré <xxxxxx@gmail.com> wrote:

John Cowan (on a private e-mail, probably by mistake)

It was indeed a mistake.
 
answered me that the beginning of the Specification says "It is an error to pass two hash tables that have different comparators or equality predicates to any of the procedures of this SRFI."

It's important to remember the special meaning of "it is an error" in Scheme specifications.  It means that no conforming program can depend on any particular result or behavior of the erroneous action, and that implementations can do whatever they like, whether reasonable or unreasonable.  In some other standards cultures the phrase used is "undefined behavior".
 
But there are many test cases of `hash-table-union!` and `hash-table-difference!` calling these procedures with hash tables with different equality predicates.

We have never made clear whether SRFI tests are supposed to be black-box (independent of a particular implementation) or white-box (dependent on the details of the sample application.  When I am writing them, I try to make them black-box, but I don't always succeed.

My feeling is that such tests should be removed, but that's up to Will.

Shouldn't standard implementation type-check the hash-tables to make sure their equality predicates are `eq?`?

That is not a requirement, no.  It gives more error-checking but less performance. In addition, on R6RS systems there is no reliable way to check procedures for identity (put another way, procedures do not have identity).  That is because an R6RS compiler can rewrite `(eq? eqv? eqv?)` as:

(eq? 
  (lambda (x y) (primitive-eqv? x y))
  (lambda (x y) (primitive-eqv? x y)))

where primitive-eql? is not available to the user and is inlined by the compiler.

-- 
John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
The native charset of SMS messages supports English, French, mainland
Scandinavian languages, German, Italian, Spanish with no accents, and
GREEK SHOUTING.  Everything else has to be Unicode, which means you get
only 70 16-bit characters in a text instead of 160 7-bit characters.