[swift-evolution] An implicit return for guard

Yarden Eitan yarneo at gmail.com
Mon Jun 20 09:12:16 CDT 2016


Adrian: I would prefer to not have it at all. But this is a better
alternative than a brand new line declaring a return, and nothing else.
This is inline and part of the ‘guard’ declaration (better context), and
definitely better than having a warning stay in your codebase.

Putting the code clarity aside, having a compiler error for a non-returned
guard seems like an overkill, and different that the other Swift
implementations (such as Switch that doesn’t need a break to not fall
through).

Xiaodi: Thank you for the links. Was an actual proposal ever formed for
this, or was it decided not to move forward?

Yarden


On June 20, 2016 at 1:33:54 AM, Adrian Zubarev via swift-evolution (
swift-evolution at swift.org) wrote:

@implicitreturn guard a = b else { print(“foo”) }

Isn’t that just the same? I mean now you even write more boilerplate then
bebore.

How does your return type look, what are you trying to solve?


-- 
Adrian Zubarev
Sent with Airmail

Am 20. Juni 2016 um 08:30:39, Yarden Eitan via swift-evolution (
swift-evolution at swift.org) schrieb:

@implicitreturn guard a = b else { print(“foo”) }

_______________________________________________
swift-evolution mailing list
swift-evolution at swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160620/4f451077/attachment.html>


More information about the swift-evolution mailing list