<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 7, 2016, at 17:37, Erica Sadun <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 7, 2016, at 6:24 PM, 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=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 7, 2016, at 17:21, Erica Sadun <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 7, 2016, at 6:15 PM, Jordan Rose via swift-users <<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:</div><div class=""><div class="" style="font-family: Palatino-Roman; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"> Today there's at least a simple rule: if the closure consists of a single expression (or a single return statement), the compiler will look at the body; otherwise it won't.</div></div></blockquote><div class=""><br class=""></div><div class="">Would it be so hard to have a rule that if there's an unambiguous expression as the last line of a closure that</div><div class="">it automagically acts as a default warn-on-unused-result return? So many of my two-line closures would</div><div class="">benefit from this.</div></div></div></div></blockquote><br class=""></div><div class="">What does that mean? You can't see how the closure is being called, so how do you know if the result is used or unused?</div><div class=""><br class=""></div><div class="">Jordan</div><br class=""></div></div></blockquote></div><br class=""><div class="">Okay, fine.</div><div class=""><br class=""></div><div class="">Would it be so hard to have a rule when there's an unambiguous expression as the last line of a closure that</div><div class="">it automagically acts as a default return? So many of my two-line closures would benefit from this.</div></div></div></blockquote><br class=""></div><div>Ah, I see what you mean now. I still think it's a bad idea, though—once you're in "statement mode", flow control ought to be explicit. Other languages have definitely had <a href="http://programmaticallyspeaking.com/why-i-hate-implicit-return-in-coffeescript.html" class="">problems with fall-off-the-end returns</a> when it's not something people use or expect all the time.</div><div><br class=""></div><div>Per my (old) discussion on the thread Javier just brought back, @warn_unused_result ought to be catching these for you, and if not then (IMHO) <i class="">that's</i> the place to be fixing things.</div><div><br class=""></div><div>Jordan</div><br class=""></body></html>