[swift-evolution] Equatable auto-write func == Proposal
Daniel Tartaglia
danielt1263 at gmail.com
Sat Sep 10 07:24:58 CDT 2016
Now that Swift 3 is out the door, I’m going to float this proposal again…
Given that every value type should be equatable (rational here): https://www.andrewcbancroft.com/2015/07/01/every-swift-value-type-should-be-equatable/
And that many, if not most, value types consist of properties that are value types.
Then the language should make it easy to conform to the Equatable protocol.
In other words, if I declare my value type as Equatable, and it is exclusively composed of value types that are already equatable, then implementing the actual == function should be optional (or maybe even forbidden.)
Implementing == in such cases is tedious boilerplate that the compiler should be able to infer on its own.
Does anybody want to help me write up an official proposal?
More information about the swift-evolution
mailing list