Re: hash functions should not be required to accept two arguments
taylanbayirli@xxxxxx 10 Nov 2015 14:26 UTC
Alex Shinn <xxxxxx@gmail.com> writes:
> > The keys could be fixnums. Since we can use negative fixnums
> > we already have more possible keys than the maximum number
> > of buckets.
>
> That's a consequence of SRFI 126's arbitrary restriction of hash
> values to non-negative integers.
>
> This is the same restriction in R6RS, libraries section 13.1:
>
> Hash-function should accept a key as an argument and
> should return a non-negative exact integer object.
Oh, so it wasn't my mistake after all. (It's a pain having hash
functions defined in three separate places in the specification...)
Now I'm conflicted on whether to lift that limitation in SRFI-126. What
does everyone think?
It sort of breaks backwards compatibility since code written for R6RS
might rely on equal-hash/etc. returning a non-negative integer. I'll
add the limitation back into SRFI-126 for now.
If anyone has a strong opinion on that the limitation should be lifted,
please say.
Taylan