[swift-evolution] Marking sort and sorted with rethrows

Christopher Kornher ckornher at me.com
Wed Jun 8 12:36:11 CDT 2016


+1 This is straightforward and self-documenting.

> On Jun 8, 2016, at 11:21 AM, 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..
> 
> -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