<div dir="ltr">Also, see: <a href="https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md">https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md</a><br><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 13, 2016 at 11:06 PM, Xiaodi Wu <span dir="ltr">&lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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: &quot;<span style="color:rgb(0,0,0)">I don&#39;t think it&#39;s something we can change.&quot;</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/" target="_blank">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"><div><div class="h5">On Mon, Jun 13, 2016 at 10:32 PM, Patrick Smith via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br></div></div><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><div class="h5">
                <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 &lt;<a dir="ltr" href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<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 &lt;<a dir="ltr" href="mailto:brent@architechies.com" target="_blank">brent@architechies.com</a>&gt;<br>Cc: swift-evolution List &lt;<a dir="ltr" href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;<div><div><br><br><br><br><div><blockquote><div>On 12 Jun 2016, at 14:46, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; 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,&#39;Liberation Mono&#39;,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,&#39;Liberation Mono&#39;,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&#39;s yet more magic to our `<font face="Menlo">if let</font>` syntax but I don&#39;t mind, it would be useful at times.</div><div><br></div><div>— Pyry</div><div><br></div><br><br></div></div></div>
        <br></div></div><span class="">_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">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></span></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div></div>