Howdy, I love it! The “do" blocks never did “feel” like Swift. I can see how both would be useful. I like to use as many conditionals in a single guard statement as I can get away with, so I was concerned that guard/catch would need to interoperate with guard/else. However, I am fairly convinced that, at least for now, having to choose between guard /catch and guard /else is not that much of a problem. guard/catch appears optimized for the simple-call case, where there is a single throwing expression, so the code can handle its specific error/s more precisely. When catching anything in a batch is the goal, then a do block is probably fine. -Ben
> On Jul 5, 2017, at 1:30 PM, Soroush Khanlou via swift-evolution > <swift-evolution@swift.org> 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 > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution