[swift-evolution] [Draft] Automatically deriving Equatable and Hashable for certain value types
pgwsmith at gmail.com
Wed May 25 21:02:32 CDT 2016
This would be very handy! It’s one of those rare scenarios where I think “I can’t believe Swift makes me type all this out, there must be an easier way”.
I think explicitly conformance to Equatable and Hashable would be preferable. This means if one of the members is not Equable/Hashable, the user knows by getting an error of ‘Does not conform to Equatable, must implement func ==’ at the type level rather than scratching their head when instances are not automatically Equatable. It also means code is only generated when it is needed.
There’s a small typo (before [sic] below):
> On 26 May 2016, at 4:28 AM, Tony Allevato via swift-evolution <swift-evolution at swift.org> wrote:
> As with raw-value enums today, should the derived conformance be completely explicit [sic], or should users have to explicitly list conformance with Equatable and Hashable in order for the compiler to generate the derived implementation?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution