Passing method arguments: Tuple vs Dict

No, the point about hash is that if you define equality for your struct, then you should also define the way the struct itself is hashed so that isequal(x::Foo, y::Foo) implies hash(x) == hash(y), as specified here: Essentials · The Julia Language

In most cases this is extremely simple. Something like:

function Base.hash(x::Foo, h::UInt)
  hash(x.a, h)
end

would work just fine.

2 Likes