[swift-evolution] [Accepted] SE-0121: Remove Optional Comparison Operators
Haravikk
swift-evolution at haravikk.me
Sat Aug 27 06:46:22 CDT 2016
> On 27 Aug 2016, at 02:01, Kevin Ballard via swift-evolution <swift-evolution at swift.org> wrote:
>
> This change is going to have a HUGE impact for me. I use this sort of comparison _all the time_ and find it incredibly useful, and have had literally zero bugs caused by this. Surely I can't be the only one who uses this. I am not looking forward to copying & pasting a reimplementation of the comparison functions into every single project I work on.
Can you give some examples as to how this will have such a huge impact? Now that we have the ?? operator it seems that this is fairly easy to replace:
value < 5 // where value is of type Int?
With:
(value ?? 0) < 5
The latter is completely clear what the behaviour of nil is.
Also, you can still re-add the operators where you need them, ideally with as limited a type as possible so you can make sure that it's behaviour is well defined.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160827/ae4b499d/attachment.html>
More information about the swift-evolution
mailing list