Skip to content

[SE-0143] Amend to explicitly allow conditional conformances to Hashable #808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Mar 20, 2018

Following discussions on this forum thread, amend SE-0143 to explicitly include the adoption of conditional conformances for Hashable by the following types:

  • Optional
  • Array
  • ArraySlice
  • ContiguousArray
  • Dictionary
  • Range
  • ClosedRange

This involves a little bit more work than Equatable: while we could make use of existing implementations of == for Equatable, none of these types currently implement hashValue.

The above list intentionally does not include types whose Hashable implementation is even remotely controversial (such as Slice, AnyCollection or AnySequence), or that don't already implement Equatable (such as CollectionOfOne or DictionaryLiteral).

A draft implementation is available in swiftlang/swift#14527. (It is being updated in parallel to this PR; a version that's in line with this amendment will be available soon.) Update: See swiftlang/swift#15382 for the implementation.

@lorentey
Copy link
Member Author

/cc @airspeedswift, @DougGregor

(The alternative of course is to submit these conformances in a separate proposal.)

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good, but let's hold off until we get approval from the Core Team before merging this.

Copy link
Member

@airspeedswift airspeedswift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@airspeedswift
Copy link
Member

Taking this amendment after core team discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants