[swift-evolution] [Proposal] function "return" optional keyword.

Step C schristopher at bignerdranch.com
Sat Dec 19 13:28:14 CST 2015


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. 


> On Dec 19, 2015, at 12:45 PM, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Afaik the concept is quite common when "everything is an expression", which can be a nice feature of a language:
> It saves keystrokes, and allows constructs like
> let value = switch key {…}
> 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.  
> Imho clarity is reduced, and it can look a little bit odd to end a function with a line like
> value
> 
> 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.
> 
> Tino
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list