[swift-evolution] Optional comparison operators

Chris Lattner clattner at apple.com
Mon Jul 11 23:12:09 CDT 2016

> On Jul 11, 2016, at 8:14 PM, Jacob Bandes-Storch via swift-evolution <swift-evolution at swift.org> wrote:
> You'd have to unwrap it, or use the ??/==/!= operators: https://gist.github.com/jtbandes/9d88cc83ceceb6c62f38 <https://gist.github.com/jtbandes/9d88cc83ceceb6c62f38>
> I'd be okay with </<=/>/>= returning Bool?, as I suggested in an older email (which somehow didn't make it to gmane's archive, but it's quoted in some other messages <http://thread.gmane.org/gmane.comp.lang.swift.evolution/10095>). I think it would be more convenient in some cases than unwrapping the individual values before comparing them.

I’d be strongly opposed to those operator returning “Bool?”.  Doing so would prevent conforming to Comparable and would be extremely surprising.


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

More information about the swift-evolution mailing list