I wonder if we should just define

hash(x::Any, ys::Any...) = hash(x, hash(ys...))

so that you can write hash(x.h, x.J, x.properties) for this. The danger is
that the two-argument form where the second argument happens to be a Uint
already means something particular, but that may be ok (I'm not sure).

On Tue, Oct 21, 2014 at 11:20 AM, Steven G. Johnson <[email protected]>
wrote:

>
>
> On Tuesday, October 21, 2014 2:35:01 AM UTC-4, Joshua Job wrote:
>>
>> So would something like
>> hash(x::ProblemInstance,h::Uint64=uint(0)) = 3*hash(x.h)+2*hash(x.J)+hash
>> (x.properties)+h
>> be a reasonable thing to do?
>>
>
> No, it is enough to define:
>
> import Base: hash
> hash(x::ProblemInstance, h::Uint64) = hash(x.h, hash(x.J,
> hash(x.properties, h)))
>
>
> That is, you should use the hash(x,y) function itself to combine multiple
> hashes, not addition or any other ad-hoc bitmixing strategy.
>

Reply via email to