What I wanted to mean was
- The IDs have encoded information into 64-bit data.
- The data have different characteristics from 64-bit integers.
- So the IDs have different optimal implementation for uniformity.
- Just adding
: Hashable
does not necessarily synthesize the optimal one. - In some cases like one I referred to, adding
: Hashable
to silence the compiler prevent to provide the optimal implementation for users.
In practice, I think handling the IDs as 64-integers and adding : Hashable
to synthesize hash(into:)
automatically works enough. But if ID
does not have the Hashable
requirement, we don't have to care it anyway. As I mentioned first that I had no concrete ideas of cases that the Hashable
requirement became a problem in practice, I know it is an awkward example. But I am not sure if there are really no cases that adding Hashable
becomes a problem because I can't foresee everything.
It is a kind of minimalism. I don't want to make types conform to needless Hashable
. I prefer being minimal because it may cause some problems in the future in long term. Identifiable.ID
in SwiftUI is OK. But the standard library is universal. I want it to be kept minimal.
Thank you all to keep trying to understand what I think from my poor English