I’m curious about the design of the integer hashing functions. Someone in my company coming from Python was annoyed to discover that the second argument to hash
doesn’t produce very different results for incremented values of h
, and there’s at least one package he was trying to use (bloom filters in Probably.jl) that assumes they would be.
julia> hash(0x000000000796a326, UInt64(0))
0x574cf859055c7b75
julia> hash(0x000000000796a326, UInt64(1))
0x574cf859055c7b72
julia> hash(0x000000000796a326, UInt64(2))
0x574cf859055c7b6f
julia> hash(0x000000000796a326, UInt64(3))
0x574cf859055c7b6c
# from hashing.jl:
hash(x::Int64, h::UInt) = hash_uint64(bitcast(UInt64, x)) - 3h
hash(x::UInt64, h::UInt) = hash_uint64(x) - 3h
I’d like to be able to explain this design decision to him, and perhaps expand the documentation to warn about using the hash function that way.