<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 class="">I’m on the side of the ‘!’ at the moment.</div><div class=""><br class=""></div><div class="">I see a lot of heat here going into hatred of the force unwrap operator, as if it should be avoided like the plague. I simply don’t see the need for such absolutism. It’s there for a reason.</div><div class=""><br class=""></div><div class="">There are definitely use cases where use of the force unwrap operator is unsafe. Specifically, a lot of direct property access shouldn’t be done with it because of the fact that even if you check, another thread may come in, switch the variable to “nil” and all of a sudden you have a crash despite your best efforts.</div><div class=""><br class=""></div><div class="">That said, if you properly reason about your code, the ! operator is a useful and reasonable access tool to unwrap the optional you know about.</div><div class=""><br class=""></div><div class="">I certainly don't agree that we need a language construct purely so we can write verbose things as a big scary warning.</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 3 May 2016, at 4:41 PM, Dominik Pich via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div 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="">;) yes. I know I can write let x = y! but IMHO THAT is too brief again. <div class="">I like the fact that <b class="">guard </b>makes you look what you do… it is a little bit like assert(x != nil)</div><div class=""><br class=""></div><div class="">guard! let x = y</div><div class=""><br class=""></div><div class="">it reads awesome and everybody can more easily see it is a potentially fatal & important call</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 3, 2016, at 1:38 AM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div 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="">We have that; it’s just ‘!’. :-)</div><div class=""><br class=""></div><div class="">Jordan</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 2, 2016, at 12:09, Dominik Pich via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div 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="">Hello,<div class="">often the guard statement is used to only unwrap optionals. multiple guards will cause a lot of ‘overhead’.</div><div class="">also often if it doesn’t work. there is no easy way we can gracefully recover ;)</div><div class=""><br class=""></div><div class="">so how about we do the same as with try/catch where you can use try! and have a guard!</div><div class=""><br class=""></div><div class="">the <b class="">guard!</b> could just throw an exception …</div><div class=""><br class=""></div><div class="">regards</div><div class="">Dominik</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>