<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div>Amazing proposal, I love it and thinking back there's plenty of times where I would have used the guard-catch instead of the non-swifty (to me) do-catch. A guard-catch construct still allows to handle errors explicitly, with the added convenience of forcing a return inside the catch, which is basically 100% of the cases for me. It's consistent with the semantics of "guard", that is, instead of indenting, exit the scope in the "negative" case.<br class=""><font color="#5856d6" class=""><br class=""></font>I do not agree in mixing guard-catch with optional binding (+ bool conditions). I think it's clearer to keep the two separated, since you can always:<br class=""><font color="#5856d6" class=""><br class=""></font>guard let x = try throwingFunction() catch { ... }<br class="">guard let y = x.optionalProperty, y == 42 else { ... }<br class=""><font color="#5856d6" class=""><br class=""><br class=""></font>Thanks<br class=""><font color="#5856d6" class=""><br class=""><br class=""></font>Elviro<br class=""><font color="#5856d6" class=""><br class=""></font><blockquote type="cite" class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">Il giorno 05 lug 2017, alle ore 19:40, Soroush Khanlou via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> ha scritto:<br class=""><blockquote type="cite" class=""></blockquote><font color="#00afcd" class=""><br class=""></font>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.<br class=""><font color="#00afcd" class=""><br class=""></font>Full proposal, which discusses all the corner cases and alternatives:<br class=""><a href="https://gist.github.com/khanlou/8bd9c6f46e2b3d94f0e9f037c775f5b9" class="">https://gist.github.com/khanlou/8bd9c6f46e2b3d94f0e9f037c775f5b9</a><br class=""><font color="#00afcd" class=""><br class=""></font>Looking forward to feedback!<br class=""><font color="#00afcd" class=""><br class=""></font>Soroush<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></div><br class=""></div></div></blockquote></div><br class=""></body></html>