Right. See also
- Modifying object dict keys
- Unable to access value in dict via known keys
- Dictionary with multiple identical keys
- Potential confusing behaviour with mutable-key Dict · Issue #33176 · JuliaLang/julia · GitHub
An alternative is to use IdDict, which hashes based on object identity. A set is simply based on a dictionary whose values are nothing. (In fact, there is an undocumented Base.IdSet that implements this, but doesn’t cover the whole Set API.)