<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 4:33 PM, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class="">Swift very deliberately does <i class="">not</i>&nbsp;infer types across multiple statements in closure bodies. This is mostly an implementation restriction (our type-checking system can't handle it very well), but it's also a simple rule that <i class="">explains</i>&nbsp;the implementation restriction, rather than having type inference in closure bodies working some of the time but not all.</div></div></div></blockquote><br class=""></div><div>OK. I understand the reasoning, and agree that it makes perfect sense. Thanks for the explanation.</div><div><br class=""></div><div>That said … I’ll note that Swift already must have logic to infer a single result type from multiple expressions, to wit, the ?: handling logic. In principle, one could collect all the return expressions in a closure and apply the same logic to them. This would have the happy consequence that common trivial cases like “only one return statement” would work as expected.</div><div><br class=""></div><div>But I understand that this is an enhancement request rather than a bug to be fixed, and won’t hold my breath. :-)</div><div><br class=""></div><div>Regards,</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>Neil Faiman</div><br class=""></body></html>