[swift-evolution] [pitch] Comparison Reform

Guillaume Lessard glessard at tffenterprises.com
Thu Apr 13 19:46:42 CDT 2017

> On Apr 13, 2017, at 18:18, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> `compare(_:)` does not merit a term-of-art exception when the Swift name is clearly `compared(to:)`.

No; in full grammatical pedanticity it should be compared(with:).
“compare to” is for dissimilar things.
“compare with” is for similar things.
(I’m not claiming that anyone cares, and I may have a traditional interpretation.)

If the whole thing remains couched in terms of comparison, I prefer the function to be named compare(_:), because it’s such an everyday term. No one expects this action to possibly have a side effect.

Guillaume Lessard

More information about the swift-evolution mailing list