<div dir="ltr">Nor I. This syntax is excellent, thanks <span style="font-size:12.8px;font-weight:bold;white-space:nowrap">Krzysztof.</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 5, 2016 at 9:56 AM, David Sweeris <span dir="ltr">&lt;<a href="mailto:davesweeris@mac.com" target="_blank">davesweeris@mac.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 style="word-wrap:break-word">Oh, cool! I didn’t realize this syntax existed.<div><br></div><div>On May 5, 2016, at 10:52 AM, Krzysztof Siejkowski via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:<div><blockquote type="cite"><br><div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">It doesn’t compile because you’re switching on the Optional and trying to pattern match it to Coin.</div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">It compiles right when you pattern match it to Optional&lt;Coin&gt;:</div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px"><div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco"><span>switch</span><span><span> </span></span><span>result</span><span><span> </span>{</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco"><span>case</span><span><span> </span>.</span><span>heads</span><span>?:<span> </span></span><span>print</span><span>(</span><span>&quot;heads&quot;</span><span>)</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco"><span>case</span><span><span> </span>.</span><span>tails</span><span>?:<span> </span></span><span>print</span><span>(</span><span>&quot;tails&quot;</span><span>)</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco"><span>case</span><span><span> </span></span><span>nil</span><span>:<span> </span></span><span>print</span><span>(</span><span>&quot;not yet flipped&quot;</span><span>)</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Monaco"><span>}</span></div></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Best,</span><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Krzysztof<br><div></div><br><p>On 5 May 2016 at 17:42:24, Eric Miller via swift-evolution (<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>) wrote:</p><blockquote type="cite"><span><div><div></div><div><div dir="ltr">Wondering if you guys think this is a reasonable idea.<div><br></div><div>I was switching on an optional enum today, and naturally gravitated towards including nil as a case:</div><div><br></div><div>enum Coin {</div><div>  case heads</div><div>  case tails</div><div>}</div><div>var result: Coin?</div><div><br></div><div>switch result {</div><div>case heads: print(&quot;heads&quot;)</div><div>case tails: print(&quot;tails&quot;)</div><div>case nil: print(&quot;not yet flipped&quot;) // exhaustive</div><div>}</div><div><br></div><div>Doesn&#39;t compile, and of course I can if-let or guard to unwrap instead, but I like the compactness of this.</div></div>_______________________________________________<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" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br></div></div></span></blockquote></div><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br></div></div></blockquote></div><br></div>