<div id="compose" contenteditable="true" style="padding-left: 16px; padding-right: 16px; padding-bottom: 8px;"><div>If Pyry’s suggestion remained the preferred way of unwrapping a tuple, could it also become the only way for unwrapping a single item?<br></div><div><br></div><div>guard case let a? = opt1 {</div><div>...</div><div>}</div><div><br></div><div>Or even shortened for matching optionals only:<br><br>guard let a? = opt1 {</div><div>...</div><div>}</div><div><br></div><div>Or even as has often been requested, to keep the same name:</div><div><br></div><div>guard let opt1? {</div><div>...</div><div>}</div><div><br></div><div>Multiples:</div><div><br></div><div>guard let (opt1?, opt2?, opt3?) {</div><div>...</div><div>}</div><div><br></div><div>guard let (a?, b?, c?) = (opt1, opt2, opt3) {</div><div>...</div><div>}</div><div><br></div><div>Sorry, not trying to derail, but it always has seemed like something shorter and more self explanatory could be made for optionals. `?` in pattern matching is a special syntax anyway, so why not make this common use case easier?<br><br><div class="acompli_signature">Patrick</div><br></div></div>
                <div class="gmail_quote">_____________________________<br>From: Pyry Jahkola via swift-evolution <<a dir="ltr" href="mailto:swift-evolution@swift.org" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="0">swift-evolution@swift.org</a>><br>Sent: Sunday, June 12, 2016 10:04 PM<br>Subject: Re: [swift-evolution] [Draft] Tuple-Based Compound Optional Binding<br>To: Brent Royal-Gordon <<a dir="ltr" href="mailto:brent@architechies.com" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="1">brent@architechies.com</a>><br>Cc: swift-evolution List <<a dir="ltr" href="mailto:swift-evolution@swift.org" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="2">swift-evolution@swift.org</a>><br><br><br><meta content="text/html charset=utf-8"><br class=""><div><blockquote class=""><div class="">On 12 Jun 2016, at 14:46, Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><pre class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">guard</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> (a, b, c) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> (opt1, opt2, opt3) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">else</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span> }</pre></div></blockquote></div><br class="">You mention `<font face="Menlo" class="">guard case</font>` 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:<div class=""><br class=""></div><div class=""><pre class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">guard case</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> (a?, b?, c?) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> (opt1, opt2, opt3) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">else</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">...</span> }</pre><div class=""><br class=""></div></div><div class="">Aside of that, it's yet more magic to our `<font face="Menlo" class="">if let</font>` syntax but I don't mind, it would be useful at times.</div><div class=""><br class=""></div><div class="">— Pyry</div><div class=""><br class=""></div><br><br></div>