[swift-evolution] [swift-evolution-announce] [Review] SE-0067: Enhanced Floating Point Protocols
nicola.salmoria at gmail.com
Sun Apr 24 04:57:42 CDT 2016
> > func isEqual(to other: Self) ->Bool
> > func isLess(than other: Self) ->Bool
> > func isLessThanOrEqual(to other: Self) ->Bool
> I'm still not sure why these are methods instead of operators.
I think this is an *excellent* choice, and I hope it is the first step to completely removing operators from protocols.
IMHO throwing operators into protocols is inconsistent and confusing. Having regular methods and a single generic version of the operator that calls down on the type’s methods is clearer and guarantees that generic code can avoid ambiguities by calling the methods directly, instead of having to rely only on heavily overloaded global operators.
More information about the swift-evolution