[swift-evolution] Equatable auto-write func == Proposal

Martin Waitz tali at admingilde.org
Mon Sep 26 06:15:44 CDT 2016


Am 2016-09-26 12:53, schrieb Francisco Costa via swift-evolution:
> +1 for making enums with payloads Equatable by default. Right now this
> requires lots of copy-paste boiler plate that can easily result in
> bugs.

Of course, making structs and enums Equatable should be much easier (the 
same is true for e.g. Hashable).
However, I still think Protocol conformance should be something which is 
specified explicitly.

When we improve support for generics we might be able to provide a 
default implementation for those cases where all fields are already 
Then, making your struct conform to Equatable would be easy:

     extension MyStruct: Equatable {}


More information about the swift-evolution mailing list