[swift-evolution] [Pitch] Guard/Catch

Soroush Khanlou soroushkhanlou at gmail.com
Wed Jul 5 12:30:50 CDT 2017


I’d like to propose a guard/catch construct to the language. It would allow code to use throwing functions and handle errors fully, without straying from a happy path. do/catch can be a bit heavy-handed sometimes, and it would be nice to be able to handle throwing functions without committing to all the nesting and ceremony of do/catch.

Full proposal, which discusses all the corner cases and alternatives:
https://gist.github.com/khanlou/8bd9c6f46e2b3d94f0e9f037c775f5b9 <https://gist.github.com/khanlou/8bd9c6f46e2b3d94f0e9f037c775f5b9>

Looking forward to feedback!

Soroush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170705/bb34f984/attachment.html>


More information about the swift-evolution mailing list