[swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

Matthew Johnson matthew at anandabits.com
Tue May 31 14:14:55 CDT 2016


> On May 31, 2016, at 2:13 PM, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> Please remove the section on guard as any of the preceding will never have single expression top level code blocks if they contain a guard clause.
> 
> I didn’t get this at first but now I see your point, it’s because the whole returning scope will need `return` at the very end so `guard` should follow that rule.
> 
> 

Exactly.  You are allowed to omit `return` if the entire body only consists of `return some().expression`

> 
> -- 
> Adrian Zubarev
> Sent with Airmail
> 
> Am 31. Mai 2016 um 21:00:43, Matthew Johnson (matthew at anandabits.com <mailto:matthew at anandabits.com>) schrieb:
> 
>> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160531/bb809045/attachment.html>


More information about the swift-evolution mailing list