[swift-evolution] Marking sort and sorted with rethrows

Dave Abrahams dabrahams at apple.com
Wed Jun 8 13:11:25 CDT 2016


on Wed Jun 08 2016, 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.

I'm not sure that these ideas are consistent with the Swift
error-handling philosophy, which IIUC is very consciously designed *not*
to support things like file- and database-backed Collections.  My
understanding is that if you have something like that, you're not
supposed to throw errors on failure, but instead find some alternative
means of error handling.  These cases seem very much in the same
ballpark.

-- 
Dave


More information about the swift-evolution mailing list