[swift-evolution] Pitch: Automatically deriving Equatable/Hashable for more value types

Tony Allevato tony.allevato at gmail.com
Mon May 15 17:20:58 CDT 2017


Yes—the PR of the proposal is here:
https://github.com/apple/swift-evolution/pull/706

It needs to be updated slightly—I'll remove the references to the
"multiplicative hash function" recommendation because I ended up using the
existing _mixInt and xor, which is how the standard library implements its
Collection hashValues. (The proposal probably really doesn't need to state
anything about the hash function used, and its entirely an implementation
detail.)


On Mon, May 15, 2017 at 3:18 PM Andrew Bennett <cacoyi at gmail.com> wrote:

> Nice work Tony! Is this proposal up for PR on swift-evolution as well?
>
> On Tue, 16 May 2017 at 7:30 am, Tony Allevato <tony.allevato at gmail.com>
> wrote:
>
>> Just to update everyone on the thread—it took a little longer than I'd
>> hoped to get the kinks out, but I finally have the implementation up as a
>> PR: https://github.com/apple/swift/pull/9619
>>
>> Hopefully there's still enough time to get the proposal reviewed, make
>> any changes needed, and get this into Swift 4!
>>
>>
>> On Tue, May 9, 2017 at 10:27 PM Brent Royal-Gordon <
>> brent at architechies.com> wrote:
>>
>>> On May 9, 2017, at 3:53 PM, Tony Allevato via swift-evolution <
>>> swift-evolution at swift.org> wrote:
>>>
>>> Likewise, proposing a new public addition to the standard library would
>>> inspire far more design discussion than I believe we have time for if we
>>> want this to make Swift 4. :)
>>>
>>>
>>> Agreed. What I would do here is add an `_combineHashes` function (or
>>> `Hashable` extension method, or whatever is most convenient) to the
>>> standard library in Swift 4, have your compiler magic feature use it, and
>>> defer the name-and-interface discussion until Swift 5.
>>>
>>> --
>>> Brent Royal-Gordon
>>> Architechies
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170515/427f277f/attachment.html>


More information about the swift-evolution mailing list