[swift-evolution] guard let x = x
Pyry Jahkola
pyry.jahkola at iki.fi
Mon Oct 31 14:58:38 CDT 2016
> On 31 Oct 2016, Xiaodi Wu wrote:
>
> An alternative that would seem to satisfy some objections is to have a distinct "unwrap" statement--as in: "unwrap x else { ... }".
True. The `let`, on the other hand, has the minor upside that it's naturally substituted with `var` where in-place mutation is needed:
guard let value, var collection else { ... }
collection.append(value)
// ...
Disclaimer: I don't know if this is a realistic usage scenario but it seems more natural to Swift, in my view.
— Pyry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161031/eea0ea1c/attachment.html>
More information about the swift-evolution
mailing list