Re: Last call for comments on SRFI 228: Composing Comparators
Jakob Wuhrer 26 Nov 2022 11:26 UTC
Daphne Preston-Kendal <xxxxxx@nonceword.org> writes:
> Wow, thanks so much for this detailed analysis!
Happy to help!
> The only problem (and it’s a real nitpick) is the hash function of
> comparator-one. Since it is implementation-defined how a product
> comparator combines the hash values of each of the comparators it is
> given, there’s no guarantee that 0 will truly be of null effect.
>
> Possible resolutions:
> 1. ignore the problem – the hash value will still be stable even if it isn’t guaranteed to be exactly same as a comparator without comparator-one mixed in
> 2. actually define how hash values in a product comparator are combined
> 3. simply require that a hash value of 0 from one of the comparators is ignored and has no effect on the output value
I think there's a fourth possible resolution: require that there is some
"neutral" hash value (not necessarily equal to 0), and that
comparator-one's hash function is the constant function with this
neutral hash value as its image.
I personally don't really know which resolution would be preferable.