<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On Apr 2, 2017, at 11:17 PM, Daniel Duan via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 2, 2017, at 11:10 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">This rule cannot hold. You cannot have the shorthand syntax you propose, disallow mixing of shorthand syntax and the longer form, *and* allow `_` to substitute for any pattern without a label.</div><div class=""><br class=""></div><div class="">```</div><div class="">enum E {</div><div class="">&nbsp; case foo(a: Int, b: Int, c: Int)</div><div class="">&nbsp; case foo(a: String, c: String, e: String)</div><div class="">}</div><div class=""><br class=""></div><div class="">let e = /* instance of E */</div><div class=""><br class=""></div><div class="">switch e {</div><div class="">case foo(let a, _, _):</div><div class="">&nbsp; // what type is `a` here?</div><div class="">&nbsp; break</div><div class="">default:</div><div class="">&nbsp; fatalError()</div><div class="">}</div><div class="">```</div></div></div></div></div></blockquote></div></div></div></div></div></blockquote></div><div class=""><blockquote type="cite" class=""><br class=""></blockquote></div><div class=""><blockquote type="cite" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">That seems like straight up ambiguity with or without restriction on the label though? This kind of usability problem should and is discouraged by the proposed solution.<div class=""><div class=""><div class=""><blockquote type="cite" class=""></blockquote></div></div></div></div></blockquote><br class=""></div><div class="">Let's make it a little more reasonable:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>enum Color {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>case color(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>case color(hue: CGFloat, saturation: CGFloat, value: CGFloat, alpha: CGFloat)</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>let c: Color = …</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span></div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>switch c {</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>case .color(_, _, _, let alpha):</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                </span>…</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div class=""><br class=""></div><div class="">Interestingly, in this example it would probably be appropriate to match both cases. I wonder if that's true in the general case.</div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal; border-spacing: 0px;"><div class=""><div style="font-size: 12px; " class="">--&nbsp;</div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>

</div>
<br class=""></body></html>