I seem to be getting different behaviour between Fable's built in "hash" function and Object.GetHashCode(). Hash seems to be correct, but GetHashCode() is not working comprehensively for tuples, lists, and maps. It seems to produce a non-deterministic output for each call, although the sequence seems to be.
Normally I would just go ahead and use hash, but my particular case is using an evil mutable dotnet dictionary, which I believe uses GetHashCode internally. This seems to be manifesting in some unpredictable behaviour.
Fable.Core issue I think. I think this is the right repo?
module GetHashCode
("hello", 1).GetHashCode() = ("hello", 1).GetHashCode() |> printf "%A"
(("hello", 1) |> hash)= (("hello", 1) |> hash) |> printf "%A"
["hello", 1].GetHashCode() = ["hello", 1].GetHashCode() |> printf "%A"
(["hello", 1] |> hash)= (["hello", 1] |> hash) |> printf "%A"
(Map.ofList ["hello", 1]).GetHashCode() = (Map.ofList ["hello", 1]).GetHashCode() |> printf "%A"
(Map.ofList ["hello", 1] |> hash)= (Map.ofList ["hello", 1] |> hash) |> printf "%A"
Both cases should return true, at the moment the GetHashCode version returns false, which implies it is not deterministic for multiple calls.
Alternatively, this breaks on whatever the version running on fable.io/repl also. (see link above).
Fixed in #2065.
Super fast, thanks @ncave your a star :)
Most helpful comment
Fixed in #2065.