[swift-evolution] [Draft] Tuple-Based Compound Optional Binding

Pyry Jahkola pyry.jahkola at iki.fi
Sun Jun 12 07:03:59 CDT 2016


> On 12 Jun 2016, at 14:46, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> 
> guard let (a, b, c) = (opt1, opt2, opt3) else { ... }

You mention `guard case` in the motivation, but I think for the uninitiated reader it would be fair to point out that the following example already works equivalently, with only a few extra characters:

guard case let (a?, b?, c?) = (opt1, opt2, opt3) else { ... }

Aside of that, it's yet more magic to our `if let` syntax but I don't mind, it would be useful at times.

— Pyry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160612/1349433f/attachment.html>


More information about the swift-evolution mailing list