You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When conditional conformance was added to the language, most collection types were updated to conditionally conform to Equatable and Hashable when their Elements conform.
I think CollectionOfOne was left out just by oversight, since conformance would be trivial.
Similarly, EmptyCollection unconditionally conforms to Equatable, but it doesn't conform to Hashable. Arguably, the usefulness of the latter would be limited, but still it would make sense for consistency.
I'm not sure if this needs to pass through Swift Evolution approval.
The text was updated successfully, but these errors were encountered:
Also, conformance to Encodable/Decodable should be considered. I presume that most of the issues that are afflicting the current evaluation of Range conformance shouldn't apply to CollectionOfOne and EmptyCollection.
I don't know if those make sense. You're not intended to persist a CollectionOfOne or an EmptyCollection; they're for interacting with APIs that require a collection to do anything.
Well, I had a use case with an associatedtype representing the elements (equivalence classes) of a quotient set, and CollectionOfOne was the perfect default.
Additional Detail from JIRA
md5: 990969e5f9342f860fe40141f06a1cc5
Issue Description:
When conditional conformance was added to the language, most collection types were updated to conditionally conform to Equatable and Hashable when their Elements conform.
I think CollectionOfOne was left out just by oversight, since conformance would be trivial.
Similarly, EmptyCollection unconditionally conforms to Equatable, but it doesn't conform to Hashable. Arguably, the usefulness of the latter would be limited, but still it would make sense for consistency.
I'm not sure if this needs to pass through Swift Evolution approval.
The text was updated successfully, but these errors were encountered: