[swift-evolution] Universal Equatability, Hashability, and Comparability

Joe Groff jgroff at apple.com
Wed Mar 9 20:11:32 CST 2016


> On Mar 9, 2016, at 5:57 PM, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
>>> Auto-deriving is a different story, though, especially if it's opt-in
>>> (you have to say `deriving Equatable`). There, you presumably have
>>> looked at the default semantics and determined they're appropriate for
>>> your type.
>> 
>> I don't know if that level of explicitness is needed.  Explicit
>> declaration of conformance might be enough.
> 
> I don't know if it's necessary either. What I'm saying is that if it *is* that explicit, it's a slam dunk; if it's *not* that explicit, it's a little more uncertain, but probably still a good idea.

IMO, since you can already get "implicitly derived" default implementations from a protocol extension simply by declaring conformance to a protocol, it would be consistent to only require a conformance declaration to access compiler-derived implementations. One could imagine Swift Pro 6s Plus having enough fancy generics features to provide the default implementations of Equatable, Hashable, etc. as protocol extensions.

-Joe


More information about the swift-evolution mailing list