[swift-evolution] [pitch]:generate == function

Joe Groff jgroff at apple.com
Tue Jan 19 14:19:00 CST 2016


> On Jan 19, 2016, at 12:14 PM, Jan E. Schotsman via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> On Jan 19, 2016, at 7:00 PM, FĂ©lix Cloutier  wrote:
> 
>> memberwise func ==? (if memberwise init does make it)
> 
> 
> That relies on implicit var members making it *and* arbitrary length tuple comparison making it into the next Swift.
> 
> I am doing some round trip tests on large structs and need to define func == for each type <sigh>

We do generate Equatable implicitly in some cases, particularly for C-imported types and for Swift enums that don't use associated values. It would be reasonable to extend this to other types, by having 'struct Foo: Equatable' cause the compiler to generate an '==' implementation for you if you don't provide one.

-Joe


More information about the swift-evolution mailing list