<p dir="ltr">Yes, this would be strange in multiline functions with different execution paths. It works well in Ruby because function return types aren't annotated, so the final expression is always a valid return value. In swift, I think it would have too much design overhead to figure out how to reconcile it with explicit return types, to be worth it with multiline functions. However, it would be great to have implicit return in single line closures with named parameters and single line functions. </p>
<br><div class="gmail_quote"><div dir="ltr">On Sat, Dec 19, 2015, 2:28 PM Step C via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There was discussion of implicit returns on the forums a while back. Will try to find the link later. The Swift team chose explicit returns for better code clarity. I still think this was the right call, even though implicit returns are certainly attractive when writing code.<br>
<br>
<br>
> On Dec 19, 2015, at 12:45 PM, Tino Heth via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br>
><br>
> Afaik the concept is quite common when "everything is an expression", which can be a nice feature of a language:<br>
> It saves keystrokes, and allows constructs like<br>
> let value = switch key {…}<br>
> But as the let syntax was changed to work with delayed assignment, one major use case is solved in a different way, and I doubt that it fits into the Swift roadmap.<br>
> Imho clarity is reduced, and it can look a little bit odd to end a function with a line like<br>
> value<br>
><br>
> On the other hand, nobody would be forced to skip the "return", and I guess it wouldn't be a complicated change in the compiler… so if you want to continue working on the proposal, I would evaluate how this change could be reflected in the docs.<br>
><br>
> Tino<br>
> _______________________________________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div>