{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift/issues/14442","repository_url":"https://api.github.com/repos/apple/swift","labels_url":"https://api.github.com/repos/apple/swift/issues/14442/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift/issues/14442/comments","events_url":"https://api.github.com/repos/apple/swift/issues/14442/events","html_url":"https://github.com/apple/swift/pull/14442","id":294925340,"number":14442,"title":"[DON'T MERGE] Alternative hashing interface","user":{"login":"lorentey","id":608696,"avatar_url":"https://avatars3.githubusercontent.com/u/608696?v=4","gravatar_id":"","url":"https://api.github.com/users/lorentey","html_url":"https://github.com/lorentey","followers_url":"https://api.github.com/users/lorentey/followers","following_url":"https://api.github.com/users/lorentey/following{/other_user}","gists_url":"https://api.github.com/users/lorentey/gists{/gist_id}","starred_url":"https://api.github.com/users/lorentey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorentey/subscriptions","organizations_url":"https://api.github.com/users/lorentey/orgs","repos_url":"https://api.github.com/users/lorentey/repos","events_url":"https://api.github.com/users/lorentey/events{/privacy}","received_events_url":"https://api.github.com/users/lorentey/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2018-02-06T21:50:40Z","updated_at":"2018-02-14T16:46:56Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/14442","html_url":"https://github.com/apple/swift/pull/14442","diff_url":"https://github.com/apple/swift/pull/14442.diff","patch_url":"https://github.com/apple/swift/pull/14442.patch"},"body":"This PR implements an alternative hashing interface that moves the choice of a hash function out of `Hashable`. Doing this allows us to evolve the hash function in the stdlib without recompiling hashable types.\r\n\r\nTo achieve this, it defines a streaming interface where hashable types can feed some stateful hash function with a variable number of `Int`s representing the bits to be hashed:\r\n\r\n```\r\npublic protocol Hashable : Equatable {\r\n  var hashValue: Int { get }\r\n  func _hash(into hasher: (Int) -> Void)\r\n}\r\n```\r\n\r\nThe new `_hash(into:)` requirement comes with a default implementation for compatibility. However, it replaces `hashValue` as the primary hashing API for `Set` and `Dictionary`.\r\n\r\nI expect we won't need to make the new method public. Outside the stdlib, it will be implemented by synthesized conformances of `Hashable`. Manually conforming `Hashable` types will continue to implement `hashValue`, as they have done since Swift 1.0. (We can't deprecate `hashValue` without significant source compatibility issues, and it doesn't seem worth the upgrade churn.)\r\n"},"comment":{"url":"https://api.github.com/repos/apple/swift/issues/comments/365669295","html_url":"https://github.com/apple/swift/pull/14442#issuecomment-365669295","issue_url":"https://api.github.com/repos/apple/swift/issues/14442","id":365669295,"user":{"login":"lorentey","id":608696,"avatar_url":"https://avatars3.githubusercontent.com/u/608696?v=4","gravatar_id":"","url":"https://api.github.com/users/lorentey","html_url":"https://github.com/lorentey","followers_url":"https://api.github.com/users/lorentey/followers","following_url":"https://api.github.com/users/lorentey/following{/other_user}","gists_url":"https://api.github.com/users/lorentey/gists{/gist_id}","starred_url":"https://api.github.com/users/lorentey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorentey/subscriptions","organizations_url":"https://api.github.com/users/lorentey/orgs","repos_url":"https://api.github.com/users/lorentey/repos","events_url":"https://api.github.com/users/lorentey/events{/privacy}","received_events_url":"https://api.github.com/users/lorentey/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T16:46:56Z","updated_at":"2018-02-14T16:46:56Z","author_association":"MEMBER","body":"The benchmark is chugging along at https://ci.swift.org/job/swift-PR-osx-perf/141/\r\n\r\nI expect the latest commit will get us back to acceptable performance."}}
{"actor":{"display_login":"lorentey"}}