[swift-evolution] [Review] SE-0185 - Synthesizing Equatable and Hashable conformance

Martin Waitz tali at admingilde.org
Thu Aug 10 04:32:54 CDT 2017

Hi Haravikk,

Am 2017-08-10 11:07, schrieb Haravikk via swift-evolution:
> I don't feel that conforming to
> Equatable/Hashable is sufficient as an opt-in. Consider for example
> someone who declares their type as Equatable/Hashable, then sets to
> work on the details of their type, forgetting to implement the actual
> equatable/hashable behaviour they want.

This is no different than a default implementation of the protocol.
In fact, the proposal just adds something like this:

     extension Struct<A, B, ...>: Equatable where A: Equatable, B: 
Equatable, ... {
         static func ==(lhs: Self, rhs: Self) -> Bool { /* insert 
implementation here */ }

We don't require/support some special keywords for other protocols with 
default implementation either,
so I see no reason to add them here.

Your concerns are orthogonal to this proposal and should be discussed 


More information about the swift-evolution mailing list