[swift-evolution] Guard Implicit Fallback
Félix Cloutier
felixcca at yahoo.ca
Thu Feb 11 11:46:13 CST 2016
Error cases are very often neglected and I feel that this would only encourage it.
Félix
> Le 10 févr. 2016 à 22:40:48, Tighe Racicot via swift-evolution <swift-evolution at swift.org> a écrit :
>
> Hey everyone,
>
> I feel that `guard` could be a little more Swifty and would like to start a conversation concerning it.
>
> For example, I often have a function whose job depends on an optional having a value, and so I guard-let at the start and return if the guard fails. Or if the function returns an optional type, I'll simply return nil if guard fails.
>
> Can we improve on the general fallback case? Could we simply say:
>
> func noReturn() {
> guard let aValue = someOptional
> ....
> }
>
> and have that imply "else { return void or nil }"
>
> What are your thoughts?
>
> Tighe
>
> _______________________________________________
> 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/20160211/a8ece021/attachment.html>
More information about the swift-evolution
mailing list