Remove collection conformances to Equatable
and Hashable
#124
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementing
Equatable
(and especiallyHashable
) correctly isn't straightforward for some of the non-trivial collection wrappers in this package, if we consider collections to be equal if they produce the same elements. Here are some examples of comparisons that should evaluate totrue
, despite the collections having unequal base collections:Implementing
Hashable
is often even harder because equal values should produce equal hash values, and therefore every collection needs to hash in the exact same way as all other collections equal to it.For the moment we're removing all conformances of the sequence and collection types to
Equatable
andHashable
to avoid any ambiguity on this front, which is consistent with sequence and collection adaptors in the standard library. Most of the times1.elementsEqual(s2)
should be preferred anyway, because it lets you compare sequences that aren't instances of the same type.Checklist