As I understand it, Julia dicts use Base.hash when storing custom types as keys. Is there a way to look up based on the hash alone?
e.g.,
type MyType
a::Int
end
Base.hash(x::MyType) = hash(x.a, hash(MyType))
x = MyType(1)
D = Dict{MyType, Bool}()
D[x] = true
Now, is there a way to lookup using h only?
h = hash(x)
D[h]
Is this be safe to do?
Thanks!
