Closed daanhb closed 6 months ago
Bump, and in addition: defining hash
for intervals should not be done in DomainSets.
I've concluded that this is hard to do. It is harder than deciding on the equality of domains, because you only have a single argument and not a combination of arguments. Since Point(0.5) == 0.5..0.5
their hashes should be the same. But a closed ball with radius zero is also a point, so should have the same hash. A unit ball in 1D is a unit interval. Etcetera.
This was completed in 8742d3a, noting that the definition of hash
in Base can still be invoked as a fallback, even if a generic implementation is made at the level of Domain
.
The logic of the
hash
function should be the same as that ofisequal
, since the intention is thata == b
should implyhash(a) == hash(b)
. I doubt this is the case right now.An example when using intervals is given in https://github.com/JuliaMath/IntervalSets.jl/issues/167:
The fact that
2..1
and3..1
hash to different values results inunique
returning two elements rather than one. DomainSets has an elaborate way of checking for equality of domains, but thehash
function doesn't, so I bet there are many more examples of this type of error.