<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="">Error cases are very often neglected and I feel that this would only encourage it.<br class=""><div class="">
<br class="Apple-interchange-newline"><span style="color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline !important; float: none;" class="">Félix</span>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">Le 10 févr. 2016 à 22:40:48, Tighe Racicot via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hey everyone, <div class=""><br class=""></div><div class="">I feel that `guard` could be a little more Swifty and would like to start a conversation concerning it.</div><div class=""><br class=""></div><div class="">For example, I often have a function whose job depends on an optional having a value, and so I guard-let at the start and return if the guard fails. Or if the function returns an optional type, I'll simply return nil if guard fails. </div><div class=""><br class=""></div><div class="">Can we improve on the general fallback case? Could we simply say:</div><div class=""><br class=""></div>func noReturn() {<br class=""> guard let aValue = someOptional<br class=""><div class=""> ....</div><div class="">}</div><div class=""><br class=""></div><div class="">and have that imply "else { return <i class="">void or nil</i> }"</div><div class=""><br class=""></div><div class="">What are your thoughts?</div><div class=""><br class=""></div><div class="">Tighe</div><div class=""><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>