Strong +1; types in the standard library should conform to Hashable
whenever possible.
Here are some additional types that could benefit from conditional Hashable
conformance, in order of decreasing (subjective) importance:
Range
and the partial range typesSlice
, with caveat belowDictionaryLiteral
CollectionOfOne
EmptyCollection
(I expect the last two would pop up mostly when they're used as constrained type parameters of generic types.)
Slice
supports unordered collections, so if we want to make it Hashable
, we need to decide if lexicographic equality and ordered hashing is suitable for it. @nnnnnnnn has a convincing argument that it is:
Indeed, a Set.SubSequence
value is decidedly not substitutable with slices from other sets, even if they happen to contain the same elements.