<div dir="ltr">On Thu, Mar 9, 2017 at 1:07 AM, Daniel Duan <span dir="ltr">&lt;<a href="mailto:daniel@duan.org" target="_blank">daniel@duan.org</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>Thanks for the thoughtful feed Xiaodi! Replies are inline. I&#39;m going to incorporate some of the responses into the proposal.</div><span class="gmail-"><div id="gmail-m_-8040313148962180841AppleMailSignature"><br></div><div>On Mar 8, 2017, at 9:56 PM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank">xiaodi.wu@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra">The rendered version differs from the text appended to your message. I&#39;ll assume the more fully fleshed out version is what you intend to submit. Three comments/questions:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;">Enum Case &quot;Overloading&quot;</h3><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">An enum may contain cases with the same full name but with associated values of different types. For example:</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">enum</span> <span class="gmail-m_-8040313148962180841gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">Expr</span> {
    <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">literal</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Bool</span>)
    <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">literal</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Int</span>)
}</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">The above cases have overloaded constructors, which follow the same rules as functions at call site for disambiguation:</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> It&#39;s clear which case is being constructed in the following.</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> aBool<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> Expr <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">literal</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">false</span>)
<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> anInt<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> Expr <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">literal</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">42</span>)</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">User must specify an <code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">as</code> expression in sub-patterns in pattern matching, in order to match with such cases:</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">literal</span>(<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> value) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> this is ambiguous</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">literal</span>(<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> value <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">as</span> <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Bool</span>) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> matches `case literal(Bool)`</span></pre></div><div class="gmail_extra"><br></div>Comment/question 1: Here, why aren&#39;t you proposing to allow `case .literal(let value: Bool)`? For one, it would seem to be more consistent. </div></div></div></blockquote><div><br></div></span><div>The example in proposal doesn&#39;t include any labels. Are you suggesting two colons for sub-patterns with labels? Like `case .literal(value: let value: Bool)`?  This looks jarring. But I&#39;m definitely open to other suggestions.</div></div></blockquote><div><br></div><div>That does look jarring. But hmm.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="gmail-"><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra">Second, since we still have some use cases where there&#39;s Obj-C bridging magic with `as`, using `as` in this way may run into ambiguity issues if (for example) you have two cases, one with associated value of type `String` and the other of type `NSString`.</div></div></div></blockquote><div><br></div></span><div>Either this should be rejected at declaration, or we need a way to accept a &quot;pre-magic&quot; resolution at pattern matching, when this scenarios is at hand.</div></div></blockquote><div><br></div><div>Or we align pattern matching to function syntax and have such cases disambiguated in that way (see below).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div> I&#39;m on the phone so I can&#39;t verify. Wouldn&#39;t function overloading face a similar problem?</div><span class="gmail-"><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"> Also, since enum cases are to be like functions, I assume that the more verbose `as` version would work for free: `case .literal(let value) as (Bool) -&gt; Expr`?</div><div class="gmail_extra"><br></div></div></div></blockquote><div><br></div></span>This is not being proposed. When a user sees/authors a case, their expectation for the declared case constructor should resemble that of a function. Pattern matching was considered separately since it&#39;s not relatable syntactically.</div></blockquote><div><br></div><div>This requires justification. If enum cases are to be like functions, then the logical expectation is that pattern matching should work in that way too. I see no rationale to undergird your claim that pattern matching is &quot;not relatable syntactically.&quot; Allowing `case .literal(let value) as (Bool) -&gt; Expr` would solve the issue above, as well as provide more flexibility with the issues below.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="gmail-"><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><a id="gmail-m_-8040313148962180841gmail-user-content-alternative-payload-less-case-declaration" class="gmail-m_-8040313148962180841gmail-anchor" href="https://github.com/dduan/swift-evolution/blob/SE0155-rev2/proposals/0155-normalize-enum-case-representation.md#alternative-payload-less-case-declaration" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Alternative Payload-less Case Declaration</h3><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">In Swift 3, the following syntax is valid:</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">enum</span> <span class="gmail-m_-8040313148962180841gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">Tree</span> {
    <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">leaf</span>() <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> the type of this constructor is confusing!</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>}</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">Tree.leaf</code> has a very unexpected type to most Swift users: <code style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(27,31,35,0.0470588);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">(()) -&gt; Tree</code></p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">We propose this syntax declare the &quot;bare&quot; case instead. So it&#39;s going to be the equivalent of</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">enum</span> <span class="gmail-m_-8040313148962180841gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">Tree</span> {
    <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">leaf</span> <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> `()` is optional and does the same thing.</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span>}</pre></div><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal"><br></span></h3><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">Comment/question 2: First, if associated values are not to be modeled as tuples, for backwards compatibility </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">the rare uses of `case leaf()` should be migrated to `case leaf(())`.</span></h3></div></div></div></blockquote></span><div>Yes,</div></div></blockquote><div><br></div><div>Cool.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>and when user uses a arbitrary name when they should have used a label, or when labels are misspelled, the compiler should suggest the correct labels.</div></div></blockquote><div><br></div><div>As below, I disagree with this restriction very strongly.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>I wasn&#39;t sure how much of migrator related thing should go into a proposal. Perhaps there should be more.</div><span class="gmail-"><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">Second, </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">to be clear, you are _not_ proposing additional sugar so that a case without an associated value be equivalent to a case that has an associated value of type `Void`, correct? You are saying that, with your proposal, both `case leaf()` and `case leaf` would be regarded as being of type `() -&gt; Tree` instead of the current `(()) -&gt; Tree`?</span></h3></div></div></div></blockquote></span><div>Correct. I&#39;m _not_ proposing implicit `Void`.</div><span class="gmail-"><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">[The latter (i.e. `() -&gt; Tree`) seems entirely fine. The former (i.e. additional sugar for `(()) -&gt; Tree`) seems mostly fine, except that it would introduce an inconsistency with raw values that IMO is awkward. That is, if I have `enum Foo { case bar }`, it would make case `bar` have implied associated type `Void`; but, if I have `enum Foo: Int { case bar }`, would case `bar` have raw value `0` of type `Int` as well as associated value `()` of type `Void`?]</span><br></h3><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal"><br></span></div><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><a id="gmail-m_-8040313148962180841gmail-user-content-pattern-consistency" class="gmail-m_-8040313148962180841gmail-anchor" href="https://github.com/dduan/swift-evolution/blob/SE0155-rev2/proposals/0155-normalize-enum-case-representation.md#pattern-consistency" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a>Pattern Consistency</h3><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><em style="box-sizing:border-box">(The following enum will be used throughout code snippets in this section).</em></p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">indirect</span> <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">enum</span> <span class="gmail-m_-8040313148962180841gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">Expr</span> {
    <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">variable</span>(<span class="gmail-m_-8040313148962180841gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)"><span class="gmail-m_-8040313148962180841gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">name</span></span>: <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>)
    <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">lambda</span>(<span class="gmail-m_-8040313148962180841gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)"><span class="gmail-m_-8040313148962180841gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">parameters</span></span>: [<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">String</span>], <span class="gmail-m_-8040313148962180841gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163)"><span class="gmail-m_-8040313148962180841gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">body</span></span>: Expr)
}</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">Compared to patterns in Swift 3, matching against enum cases will follow stricter rules. This is a consequence of no longer relying on tuple patterns.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">When an associated value has a label, the sub-pattern must include the label exactly as declared. There are two variants that should look familiar to Swift 3 users. Variant 1 allows user to bind the associated value to arbitrary name in the pattern by requiring the label:</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">variable</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">name</span>: <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> x) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> okay</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">variable</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">x</span>: <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> x) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> compile error; there&#39;s no label `x`</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">lambda</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">parameters</span>: <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> params, <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">body</span>: <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> body) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> Okay</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">lambda</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">params</span>: <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> params, <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">body</span>: <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> body) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> error: 1st label mismatches</span></pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">User may choose not to use binding names that differ from labels. In this variant, the corresponding value will bind to the label, resulting in this shorter form:</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">variable</span>(<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> name) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> okay, because the name is the same as the label</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">lambda</span>(<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> parameters, <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> body) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> this is okay too, same reason.</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">variable</span>(<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> x) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> compiler error. label must appear one way or another.</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">lambda</span>(<span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> params, <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> body) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> compiler error, same reason as above.</span></pre></div><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">Comment/question 3: </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">Being a source-breaking change, that requires extreme justification, and I just don&#39;t think there is one for this rule. </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">The perceived problem being addressed (that one might try to bind `parameters` to `body` and `body` to `parameters`) is unchanged whether enum cases are modeled as tuples or functions, so aligning enum cases to functions is not in and of itself justification to revisit the issue of whether to try to prohibit this. </span></h3></div></div></div></blockquote></span><div>To reiterate, here patterns are changed not for any kind of &quot;alignment&quot; with function syntax. It changed because we dropped the tuple pattern (which remains available for matching with tuple values, btw), therefore we need to consider what a first-class syntax for enum case would look like.</div></div></blockquote><div><br></div><div>Since the rationale for this proposal is to &quot;normalize&quot; enum cases by making them more function-like, again you will need to justify why pattern matching should break from that overarching goal.</div><div><br></div><div>This is a source-breaking change, so it&#39;s not enough that a &quot;first-class syntax&quot; from the ground up would be different from the status quo (which was the Swift 3 evolution standard--if we were to do it again from scratch, would we still do it this way?). The Swift 4 evolution expectation is that a source-breaking change should require &quot;extreme&quot; justification.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>The justification for this breaking change is this: with tuples, labels in pattern is not well enforced. User can skip them, bind value to totally arbitrary names, etc. I personally think emulating such rule prevents us from making pattern matching easier to read for experienced devs and easier to learn for new comers. </div></div></blockquote><div><br></div><div>Perhaps, but this is an argument that tuple pattern binding is inferior. It has nothing to do with enum cases in particular. In fact, several threads have touched on this topic holistically. The conclusions there have been that allowing (a: Int, b: Int) to bind (Int, Int) or vice versa is healthy and useful, but allowing (a: Int, b: Int) to bind (b: Int, c: Int) is not so good, and (a: Int, b: Int) binding (b: Int, a: Int) is counterintuitive and should be removed.</div><div><br></div><div>Emulating tuple rules is the backwards-compatible way. Therefore, it ought to be the default unless the source-breaking alternative is not merely easier but _overwhelmingly_ easier. If tuples are dangerously broken, then that calls for a proposal to change tuples.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>It&#39;s reasonable to expect existing patterns in the wild either already use the labels found in declaration or they are matching against label-less cases.</div></div></blockquote><div><br></div><div>I don&#39;t think that is reasonable to expect.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>In other words, existing code with good style won&#39;t be affected much.</div></div></blockquote><div><br></div><div>You&#39;re defining your preference as &quot;good style&quot; and saying that a proposal to enforce your preference by the compiler won&#39;t affect code with &quot;good style&quot; (i.e. adhering to your preference), which is tautologically true and also not a valid argument.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>For the code that actually would break, I think the migrator and the compiler can provide sufficient help in form of migration/fixits/warnings.</div><div><br></div><div>Ultimately I think requiring appearance of labels one way or another in patterns will improve both the readability of the pattern matching site as well as forcing the author of case declaration consider the use site more.</div><span class="gmail-"><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">In fact, I think the proposed solution suffers from two great weaknesses.</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal"> First, it seems ad-hoc. Consider this: i</span><span style="font-family:arial,sans-serif;font-size:small;font-weight:normal;color:rgb(34,34,34)">f enum cases are to be modeled as functions, then I should be able to write something intermediate between the options above; namely: `case .variable(name:)(let x)`. Since `.variable` unambiguously refers to `.variable(name:)`, I should also be allowed to write `.variable(let x)` just as I am now.</span></h3></div></div></div></blockquote></span>Again, patterns are not to be modeled after functions. Only the declaration and usage of case constructors are.</div></blockquote><div><br></div><div>This requires justification. Why are they not to be? IMO, they ought to be.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="gmail-"><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><h3 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;font-size:1.25em;line-height:1.25;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><span style="font-family:arial,sans-serif;font-size:small;font-weight:normal;color:rgb(34,34,34)"> Second</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">, it </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">seems unduly restrictive. If, in the containing scope, I have a variable named `body` that I don&#39;t want to shadow, this rule would force me to either write the more verbose form or deal with shadowing `body`. </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal">If a person opts for the shorter form, they are choosing not to use the label.</span></h3></div></div></div></blockquote></span><div>In fact this (to avoid label conflict in nesting) is the only reason the longer form allows rebinding to other names at all! You say &quot;unduly restrictive&quot;, I say &quot;necessarily flexible&quot; :)</div></div></blockquote><div> </div><div>The great majority of Swift users don&#39;t read this list, nor care about the starting point from which a proposal added &quot;flexibility.&quot; They compare Swift N to Swift N + 1, and in this case, there is a new restriction. That is the only comparison which matters. So make no mistake, you are proposing a source-breaking restriction. For the arguments I gave in my earlier reply, I believe it is _unduly_ restrictive.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="auto"><span class="gmail-"><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra"><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:normal"><br></span></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">Only one of these variants may appear in a single pattern. Swift compiler will raise a compile error for mixed usage.</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">lambda</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">parameters</span>: <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> params, <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> body) <span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> error, can not mix the two.</span></pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px">Some patterns will no longer match enum cases. For example, all associated values can bind as a tuple in Swift 3, this will no longer work after this proposal:</p><div class="gmail-m_-8040313148962180841gmail-highlight gmail-m_-8040313148962180841gmail-highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;;font-size:16px"><pre style="box-sizing:border-box;font-family:sfmono-regular,consolas,&#39;liberation mono&#39;,menlo,courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);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="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box">//</span> deprecated: matching all associated values as a tuple</span>
<span class="gmail-m_-8040313148962180841gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">if</span> <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> .<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">lambda</span>(f) <span class="gmail-m_-8040313148962180841gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> anLambdaExpr {
    <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">evaluateLambda</span>(<span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">parameters</span>: f.<span class="gmail-m_-8040313148962180841gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">parameters</span>, <span class="gmail-m_-8040313148962180841gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">body</span>: f.<span class="gmail-m_-8040313148962180841gmail-pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)">body</span>)
}</pre><div><br></div></div><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,blinkmacsystemfont,&#39;segoe ui&#39;,helvetica,arial,sans-serif,&#39;apple color emoji&#39;,&#39;segoe ui emoji&#39;,&#39;segoe ui symbol&#39;"><a id="gmail-m_-8040313148962180841gmail-user-content-source-compatibility" class="gmail-m_-8040313148962180841gmail-anchor" href="https://github.com/dduan/swift-evolution/blob/SE0155-rev2/proposals/0155-normalize-enum-case-representation.md#source-compatibility" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"></a></h2></div></div>
</div></blockquote></span></div></blockquote></div><br></div></div>