on Sun Apr 24 2016, Brent Royal-Gordon <[email protected]> wrote:

>> Regarding how this affects sorting methods though, some people (myself 
>> included) like the simplicity of being able to do the following:
>> 
>>      myArray.sort(>) // If array is of Comparable elements, just throw in 
>> the operator
>
> That is extremely convenient. With my proposed extensions, it's actually 
> writeable as this:
>
>       myArray.sorted { ($0 <=> $1).reversed() }
>
> But that's obviously much less convenient. It's also equivalent to this:
>
>       myArray.sorted { $1 <=> $0 }
>
> Which means, with the proper higher-order function, it's the same as this:
>
>       myArray.sorted(flip(<=>))

There's no reason we can't accept both kinds of ordering function, though it
does expand the overload set, which is a usability downside.

-- 
Dave

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to