<div dir="ltr">This has been suggested before, I believe. The core team has weighed in several times; it seemed like there was some disagreement amongst them whether the current syntax is the wisest, but the concluding statement seemed uncontroversial: "<span style="color:rgb(0,0,0)">I don't think it's something we can change."</span><div><font color="#000000"><br></font></div><div><font color="#000000">Source:<br></font><div><a href="http://article.gmane.org/gmane.comp.lang.swift.evolution/15879/">http://article.gmane.org/gmane.comp.lang.swift.evolution/15879/</a><br><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 13, 2016 at 10:32 PM, Patrick Smith via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                <div 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>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" target="_blank">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" target="_blank">brent@architechies.com</a>><br>Cc: swift-evolution List <<a dir="ltr" href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>><div><div class="h5"><br><br><br><br><div><blockquote><div>On 12 Jun 2016, at 14:46, Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br><div><pre style="font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px;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"><span style="color:rgb(167,29,93)">guard</span> <span style="color:rgb(167,29,93)">let</span> (a, b, c) <span style="color:rgb(167,29,93)">=</span> (opt1, opt2, opt3) <span style="color:rgb(167,29,93)">else</span> { <span style="color:rgb(167,29,93)">...</span> }</pre></div></blockquote></div><br>You mention `<font face="Menlo">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><br></div><div><pre style="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"><span style="color:rgb(167,29,93)">guard case</span> <span style="color:rgb(167,29,93)">let</span> (a?, b?, c?) <span style="color:rgb(167,29,93)">=</span> (opt1, opt2, opt3) <span style="color:rgb(167,29,93)">else</span> { <span style="color:rgb(167,29,93)">...</span> }</pre><div><br></div></div><div>Aside of that, it's yet more magic to our `<font face="Menlo">if let</font>` syntax but I don't mind, it would be useful at times.</div><div><br></div><div>— Pyry</div><div><br></div><br><br></div></div></div>
        <br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div></div></div>