JuliaTime / TimeZones.jl

IANA time zone database access for the Julia programming language
Other
86 stars 52 forks source link

why does `isequal` and `==` have different definitions for `VariableTimeZone` #334

Open oxinabox opened 3 years ago

oxinabox commented 3 years ago

It would be good to either delete isequal (so it falls back to ==) or add a comment to the code explaining the reason for the difference

https://github.com/JuliaTime/TimeZones.jl/blob/906cea08c2ca4a5c76b12e14fb60d5df7990fbf7/src/types/variabletimezone.jl#L29-L39

omus commented 3 years ago

There's definitely something weird going on here as hash and isequal aren't really the same at all here.

oxinabox commented 3 years ago

hash is fine. Recall that isequal(a,b) implies hash(a) == hash(b), but that the reverse does not hold. and that generally it is good to have hash depending on only a subset of the things that are required for equality, so that it is faster. We changed hash to only depend on name a while back for speed.

But the isequals and == seems odd. Since normally those differ only in presence of NaN or missing

omus commented 3 years ago

Oh yes, I forgot about the adventure that was https://github.com/JuliaTime/TimeZones.jl/pull/281