Could I ask what would be an application of this capability (if it were 
possible)?  -- Steve Vavasis

On Wednesday, January 13, 2016 at 3:59:57 PM UTC-5, Ritchie Lee wrote:
>
> 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!
>

Reply via email to