I tried running the following code in multiple different Julia REPL sessions, on MacOSX and Linux, and I always got the exact same outputs:
julia> hash(123), hash("123"), hash([1,2,3]), hash((1,2,3)), hash(Set([1,2,3])), hash(:123)
(0x54657e9dbfd649e5, 0xb4e92987fa06fcab, 0xecc5186e7be222c6, 0xafc764e9c2b7cde5, 0x66406071c4c9b92a,
0x54657e9dbfd649e5)
Question: is this behavior guaranteed by the language? Or can the outputs vary (like they do in Python, across sessions, platforms and versions)?
Note: this question is related to my other question about the stability of the order of hash-based collections such as Set
and Dict
(it's closely related, but different).
They are not stable and can change from version to version or platforms. They are already different between systems with different word sizes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With