I didn’t think I was going to like it but I really do. My only concern,
which isn’t really a deal breaker, is what it would look like to chain multiple
try and let statement in the same guard. Unless that scenario works well I
don’t think you could convince others. i.e. In the case where I have:
guard try something(), let thing = optionalThing catch { }
What happens when the let fails? No implicit error?
Jon
> On Jul 5, 2017, at 1:30 PM, Soroush Khanlou via swift-evolution
> <[email protected]> wrote:
>
> 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
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution