[swift-evolution] [Accepted] SE-0121: Remove Optional Comparison Operators

Tino Heth 2th at gmx.de
Sun Aug 28 08:04:13 CDT 2016


> Am 28.08.2016 um 05:34 schrieb Kevin Ballard via swift-evolution <swift-evolution at swift.org>:
> 
>> My biggest issue with Optional conforming to Comparable is that while a default implementation may sometimes be useful, it may not necessarily be the one you want.
> 
> Isn't that true for almost everything?

That reminds me on a feature that has been discussed and added before:
Making tuples conform to Comparable (https://github.com/apple/swift-evolution/blob/master/proposals/0015-tuple-comparison-operators.md <https://github.com/apple/swift-evolution/blob/master/proposals/0015-tuple-comparison-operators.md>)
The implementation doesn't hurt me, but imho it's use is very limited as well.

As for comparing optionals, my preferred result would be an Optional<Bool>:
if (value < 5) ?? true {…
It makes no assumptions on the order, is clear and also concise.

Tino

> There was a sketch of this posted to swift-evolution several weeks ago, but I don’t have a link offhand.

That, on the other hand, reminds me on the discussion about switching to another platform, because the mailing list sucks. I couldn't find a link to that one either (guess why ;-)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160828/a9afc425/attachment.html>


More information about the swift-evolution mailing list