[swift-evolution] Marking sort and sorted with rethrows

L. Mihalkovic laurent.mihalkovic at gmail.com
Wed Jun 8 23:11:46 CDT 2016



> On Jun 8, 2016, at 7:21 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>>> On Jun 8, 2016, at 7:52 AM, Brent Royal-Gordon <brent at architechies.com> wrote:
>>> 
>>> Is there a widely used comparison function that throws?
>> 
>> Any comparison function that examines external data related to the instance:
>> 
>> * Sorting filenames by the data in the corresponding files
>> * Instances backed by a database where actually loading the data could fail
>> * Etc.
> 
> Ok, instead of using rethrows, would it be a better overall design be to define two overloads, one that takes a throwing closure and one that doesn’t?  This allows the throw-supporting implementation to be slower without punishing the normal case..
> 

Smilar solution to what java did.


> -Chris
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list