[swift-evolution] Optional comparison operators
Chris Lattner
clattner at apple.com
Mon Jul 11 19:59:58 CDT 2016
> On Jul 11, 2016, at 5:29 PM, Mark Lacey via swift-evolution <swift-evolution at swift.org> wrote:
>
>
>> On Jul 11, 2016, at 4:56 PM, Jacob Bandes-Storch <jtbandes at gmail.com <mailto:jtbandes at gmail.com>> wrote:
>>
>> Personally I think we should just remove these optional-taking variants of the comparison operators. Does anyone agree/disagree?
>
> I believe that a well-defined ordering of optionals and non-optionals is required in order to allow sorting an array of optionals.
Yes, I agree that this should work in principle. The problem with this argument (in Swift 3) is that Optional itself can’t conform to comparable, because that requires conditional conformances. You have to use the closure-taking form of sort, at which point, using a more verbose way to compare the optional isn’t completely terrible.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160711/7ad46a6d/attachment.html>
More information about the swift-evolution
mailing list