<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 8, 2017, at 4:26 PM, Robert Widmann <<a href="mailto:devteam.codafi@gmail.com" class="">devteam.codafi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><br class="Apple-interchange-newline">On Sep 8, 2017, at 2:59 PM, Matthew Johnson <<a href="mailto:matthew@anandabits.com" class="">matthew@anandabits.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class="Apple-interchange-newline">On Sep 8, 2017, at 2:17 PM, Robert Widmann <<a href="mailto:devteam.codafi@gmail.com" class="">devteam.codafi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class="Apple-interchange-newline">On Sep 4, 2017, at 11:35 AM, Matthew Johnson via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Sep 4, 2017, at 11:47 AM, T.J. Usiyan <<a href="mailto:griotspeak@gmail.com" class="">griotspeak@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I wasn't arguing for a strictly parallel syntax. I was arguing against being able to omit labels. I don't view those as strictly tied together. How are they?</div></div></blockquote><div class=""><br class=""></div><div class="">Like Xiaodi I don’t think it would be productive to rehash the prior discussion so I’m going to try to be brief. </div><div class=""><br class=""></div><div class="">In the discussion one idea that arose was to support two labels for associated values in a manner similar to parameters. One would be used during construction and the other during matching. </div><div class=""><br class=""></div><div class="">The idea behind this was that when creating a value a case is analagous to a factory method and it would be nice to be able provide labels using the same naming guidelines we use for external argument labels. For example, if an associated value was an index `at` might be used for clarity at the call site. Labels like this don’t necessarily make as much sense when destructuring the value. The idea of the “internal” label of a case was that it would be used when matching and could be elided if the bound name was identical. In the example, `index` might be used.</div></div></div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">It’s an interesting idea, but I don’t know of too many cases where I wouldn’t want the name for destructuring to serve as an API name somehow. A function may use labels to aid understanding, flow, readability, etc. but an enum case is not necessarily a function-like value, nor does this proposal want them to be (modulo some internal modeling).</div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">An enum case is *exactly* analogous to a static factory method or property when it is used to construct values. It obviously plays a different role in pattern context.</div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><br class=""></div><div class="">When matching, `let` is interspersed between the label and the name binding.</div></div></div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Good thing this works then</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">enum</span><span class="Apple-converted-space"> </span>Foo {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span>foo(x:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">Int</span>, y:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">String</span>, z:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">Float</span>)</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);">}</div><div class="" style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">func</span><span class="Apple-converted-space"> </span>bar(<span class="" style="color: rgb(186, 45, 162);">_</span><span class="Apple-converted-space"> </span>x :<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">Foo</span>) {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162); background-color: rgb(255, 255, 255);"><span class=""> <span class="Apple-converted-space"> </span></span>switch<span class=""><span class="Apple-converted-space"> </span>x {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">let</span><span class="Apple-converted-space"> </span>.<span class="" style="color: rgb(49, 89, 93);">foo</span>(x: x, y: y, z: z):<span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">break</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);">}</div></div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I consider this syntax to be an anti-pattern. It can be unclear where a new name is bound and where the value of a pre-existing name is matched.</div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Even better, John mentioned in the rationale that if the labels ever grow to be clumsy we can come up with some kind of “ellipses-like” pattern to indicate we intend to match all the labelled values as they are so named, etc. </div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">It sounds like this would introduce name bindings without the name being explicitly declared. That works fine where there is a standard pattern such as `oldValue` in a property observer. I’m not sure I would like it in this context though.</div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Or, and this is the far easier thing that can and should be done today, just use a struct.</div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I generally agree with this advice.</div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""> Any label is already at a distance from the name it labels. Instead of providing a label the important thing is that the semantic of the bound variable be clear at the match site. Much of the time the label actually reduces clarity at a match site by adding verbosity and very often repetition. If the bound name clearly communicates the purpose of the associated value a label cannot add any additional clarity, it can only reduce clarity.</div></div></div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I disagree. This would make sense in a world where we didn’t allow overloading. But for the purpose of disambiguation, this kind of logic breaks down. Say we have this construction</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">func</span><span class="Apple-converted-space"> </span>bar(<span class="" style="color: rgb(186, 45, 162);">_</span><span class="Apple-converted-space"> </span>x :<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">Foo</span>) {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162); background-color: rgb(255, 255, 255);"><span class=""> <span class="Apple-converted-space"> </span></span>switch<span class=""><span class="Apple-converted-space"> </span>x {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">let</span><span class="Apple-converted-space"> </span>.<span class="" style="color: rgb(49, 89, 93);">foo</span>(x, y, z):<span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">break</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">let</span><span class="Apple-converted-space"> </span>.<span class="" style="color: rgb(49, 89, 93);">foo</span><span class="" style="text-decoration: underline;">(</span>x, y, z, w):<span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">break</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> }</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; background-color: rgb(255, 255, 255);">Without the definition of the original enum, could you tell me what each of these cases were for, and why they were named so similarly? Eliding the label does not enable clarity, it saves keystrokes and enables ambiguous patterns.</div></div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">As stated above, I strongly dislike the syntax that distributes the `let` as I find *that* to be unclear. Let’s rewrite that example:</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">func</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">bar(</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">_</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">x :</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(79, 129, 135);">Foo</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">) {</span><br class=""><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">switch</span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> x {</span><br class=""><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">case</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">.</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(49, 89, 93);">foo</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">(</span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">let</span> <span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">x, </span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">let</span> <span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">y, </span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">let</span> <span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">z):</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">break</span></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">case</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">.</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(49, 89, 93);">foo</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); text-decoration: underline;">(</span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">let</span> <span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">x, </span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">let</span> <span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">y, </span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">let</span> <span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">z, </span><span class="" style="color: rgb(186, 45, 162); font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">let</span> <span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">w):</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">break</span></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> }</span><br class=""><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);">}</div></div></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Now I can see exactly where names are being bound. I know if a label exists it matches the name that is bound. If two distinct cases might be matched I would expect a compiler error. For example, if Foo was defined as follows the above switch to produce an error on the second pattern but not the first:</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">enum</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">Foo {</span></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">case</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">foo(x:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">Int</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">, y:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">String</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">, z:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">Float</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">)</span></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">case</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">foo(x:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">Int</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">, y:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">String</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">, z:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">Float, s: String</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">)</span></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(186, 45, 162);">case</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">foo(x:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">Int</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">, y:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">String</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">, z:</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);"> </span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255); color: rgb(112, 61, 170);">Float, w: Double</span><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">)</span><font face="Menlo" class=""><span class="" style="font-size: 11px; background-color: rgb(255, 255, 255);"><br class=""></span></font><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><br class=""></div><div class="" style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255);">If the proposal had been accepted without the modification I would not find the above switch ambiguous in behavior although I admit that it carries more potential for mistake than a design that requires explicit labels to disambiguate an overloaded base name.</div></div></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><br class=""></div><div class="">The proposal acknowledges most of this by allowing us to elide labels when the bound name matches the label. </div></div></div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">That part of the proposal was not accepted which is part of why I’m bringing this up at all. </div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I thought the part that elides labels was accepted with the modification that this only applies when the base name is unambiguous. I suspect overloaded base names will be relatively rare so I think the case of unambiguous base names is by far the most important. I think the rationale given is pretty good.</div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I’ll quote the rationale (minus some extraneous text in the examples):</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><pre class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"><blockquote type="cite" class="">A case pattern may omit labels for the associated values of a case if there is only one case with the same base name and arity. A pattern must omit all labels if it omits any of them; thus, a case pattern either exactly matches the full name of a case or has no labels at all. For example:</blockquote></pre><div class=""><pre class="" style="white-space: pre-wrap; background-color: rgb(255, 255, 255);"> enum E {
<span class="Apple-tab-span" style="white-space: pre;">        </span>// ...
case many(value: Int)
case many(first: Int, second: Int)
case many(alpha: Int, beta: Int)
<span class="Apple-tab-span" style="white-space: pre;">        </span>// ...
}</pre><div class=""><br class=""></div></div></div><pre class="" style="font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255);"> // Valid: there is only one case with this base name and payload count.
case .many(let a):</pre><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">If we’re matching by arity, the labels go out the door; this part of the proposal was not accepted.</div></div></blockquote><div><br class=""></div><div>That’s not how I read it: "<span style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">A pattern must omit all labels <b class="">if it omits any of them</b>; thus, a case pattern either exactly matches the full name of a case or has no labels at all."</span></div><div class=""><br class=""></div><div class="">In any case, I agree with the rationale and proposal-as-accepted. I disagree with your proposed modification to always require labels when the case name includes them. I’ve said my two cents and don’t think it’s useful to continue going back and forth.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">~Robert Widmann</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Besides, it wouldn’t have worked quite the way the authors intended.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">enum</span><span class="Apple-converted-space"> </span>Foo {</div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span>foo(x:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">Int</span>, x:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">String</span>)</div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);">}</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">func</span><span class="Apple-converted-space"> </span>bar(<span class="" style="color: rgb(186, 45, 162);">_</span><span class="Apple-converted-space"> </span>x :<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">Foo</span>) {</div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(186, 45, 162); background-color: rgb(255, 255, 255);"><span class=""> <span class="Apple-converted-space"> </span></span>switch<span class=""><span class="Apple-converted-space"> </span>x {</span></div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><span class=""> <span class="Apple-converted-space"> </span></span>// We wanted to avoid labels, but instead we would be required to redeclare</div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><span class=""> <span class="Apple-converted-space"> </span></span>// 'x' in this pattern which forces the use of labels to allow a different bound name.</div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">let</span><span class="Apple-converted-space"> </span>.<span class="" style="color: rgb(49, 89, 93);">foo</span>(x, x):<span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">break</span></div><div class="" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> }</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="" style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);">}</span> </div></div></blockquote><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">This would of course need to be rejected because it attempts to bind the same name twice. I don’t think anyone intended for this to work.</div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">~Robert Widmann</div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Sep 4, 2017 at 12:38 PM, Matthew Johnson<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:matthew@anandabits.com" target="_blank" class="">matthew@anandabits.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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 class="" style="word-wrap: break-word;"><br class=""><div class=""><span class=""><blockquote type="cite" class=""><div class="">On Sep 4, 2017, at 10:52 AM, T.J. Usiyan via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class="m_-1981483755852647202Apple-interchange-newline"><div class=""><div dir="ltr" class="">While re-litigating has it's issues, I am for simplifying the rule and always requiring the labels if they exist. This is similar to the change around external labels. Yes, it is slightly less convenient, but it removes a difficult to motivate caveat for beginners.</div></div></blockquote><div class=""><br class=""></div></span><div class="">I disagree. Creating a value and destructuring it are two very different operations and I believe it is a mistake to require them to have parallel syntax. </div><div class=""><br class=""></div><div class="">Imagine a future enhancement to the language that supports destructuring a struct. A struct might not have a strictly memberwise initializer. It might not even be possible to reconstruct initializer arguments for the sake of parallel destructuring syntax. There might even be more than one projection that is reasonable to use when destructuring the value in a pattern (such as cartesian and polar coordinates).</div><div class=""><br class=""></div><div class="">FWIW, I made this case in more detail during the discussion and review of this proposal.</div><div class=""><div class="h5"><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Sep 3, 2017 at 4:35 PM, Xiaodi Wu via swift-evolution<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><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;">The desired behavior was the major topic of controversy during review; I’m wary of revisiting this topic as we are essentially relitigating the proposal.<br class=""><br class="">To start off, the premise, if I recall, going into review was that the author **rejected** the notion that pattern matching should mirror creation. I happen to agree with you on this point, but it was not the prevailing argument. Fortunately, we do not need to settle this to arrive at some clarity for the issues at hand.<br class=""><br class="">From a practical standpoint, a requirement for labels in all cases would be much more source-breaking, whereas the proposal as it stands would allow currently omitted labels to continue being valid. Moreover, and I think this is a worthy consideration, one argument for permitting the omission of labels during pattern matching is to encourage API designers to use labels to clarify initialization without forcing its use by API consumers during every pattern matching operation.<br class=""><br class="">In any case, the conclusion reached is precedented in the world of functions:<br class=""><br class="">func g(a: Int, b: Int) { ... }<br class="">let f = g<br class="">f(1, 2)<br class=""><br class=""><div class="gmail_quote"><div class=""><div class="m_-1981483755852647202h5"><div dir="ltr" class="">On Sun, Sep 3, 2017 at 15:13 Robert Widmann via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div></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 class=""><div class="m_-1981483755852647202h5"><div class="" style="word-wrap: break-word;">Hello Swift Evolution,<div class=""><br class=""></div><div class="">I took up the cause of implementing <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md" target="_blank" class="">SE-0155</a>, and am most of the way through the larger points of the proposal. One thing struck me when I got to the part about <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md#pattern-consistency" target="_blank" class="">normalizing the behavior of pattern matching</a>. The Core Team indicated in their <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170417/035972.html" target="_blank" class="">rationale</a> that the proposal’s suggestion that a variable binding sub in for a label was a little much as in this example:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">enum</span><span class="Apple-converted-space"> </span>Foo {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span>foo(x: Int, y: Int)</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space"> </span>.foo(x: x, y: y) {}<span class="Apple-converted-space"> </span></span>// Fine! Labels match and are in order</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space"> </span>.foo(x, y: y) {}<span class="Apple-converted-space"> </span></span>// Bad! Missing label 'x'</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space"> </span>.foo(x, y) {}<span class="Apple-converted-space"> </span></span>// Fine? Missing labels, but variable names match labels</div></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><span class="" style="font-family: Helvetica; font-size: 12px;">They instead suggested the following behavior:</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0); background-color: rgb(255, 255, 255);"><span class="" style="font-family: Helvetica; font-size: 12px;"><br class=""></span></div><div class="" style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255);"><div class="" style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"><span class="" style="color: rgb(186, 45, 162);">enum</span><span class="Apple-converted-space"> </span>Foo {</div><div class="" style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span>foo(x: Int, y: Int)</div><div class="" style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;">}</div><div class="" style="color: rgb(0, 132, 0); font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space"> </span>.foo(x: x, y: y) {}<span class="Apple-converted-space"> </span></span>// Fine! Labels match and are in order</div><div class="" style="color: rgb(0, 132, 0); font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space"> </span>.foo(x, y: y) {}<span class="Apple-converted-space"> </span></span>// Bad! Missing label 'x'</div><div class="" style="color: rgb(0, 132, 0); font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space"> </span>.foo(x, y) {}<span class="Apple-converted-space"> </span></span>// Fine? Missing labels, and full name of case is unambiguous</div><div class="" style="color: rgb(0, 132, 0); font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><div class="" style="margin: 0px; line-height: normal;">Which, for example, would reject this:</div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(186, 45, 162);">enum</span><span class="Apple-converted-space"> </span>Foo {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span>foo(x: Int, y: Int)<span class="Apple-converted-space"> </span><span class="" style="color: rgb(0, 132, 0);">// Note: foo(x:y:)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"> <span class="Apple-converted-space"> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class="Apple-converted-space"> </span>foo(x: Int, z: Int)<span class="Apple-converted-space"> </span><span class="" style="color: rgb(0, 132, 0);">// Note: foo(x:z:)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">case</span><span class=""><span class="Apple-converted-space"> </span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space"> </span>.foo(x, y) {}<span class="Apple-converted-space"> </span></span>// Bad! Are we matching foo(x:y:) or foo(x:z:)?</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">With this reasoning:</div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><pre class="" style="white-space: pre-wrap;"></pre><blockquote type="cite" class=""><pre class="" style="white-space: pre-wrap;"> - While an associated-value label can indeed contribute to the readability of the pattern, the programmer can also choose a meaningful name to bind to the associated value. This binding name can convey at least as much information as a label would.
- The risk of mis-labelling an associated value grows as the number of associated values grows. However, very few cases carry a large number of associated values. As the amount of information which the case should carry grows, it becomes more and more interesting to encapsulate that information in its own struct — among other reasons, to avoid the need to revise every matching case-pattern in the program. Furthermore, when a case does carry a significant number of associated values, there is often a positional conventional between them that lowers the risk of re-ordering: for example, the conventional left-then-right ordering of a binary search tree. Therefore this risk is somewhat over-stated, and of course the programmer should remain free to include labels for cases where they feel the risk is significant.
- It is likely that cases will continue to be predominantly distinguished by their base name alone. Methods are often distinguished by argument labels because the base name identifies an entire class of operation with many possible variants. In contrast, each case of an enum is a kind of data, and its name is conventionally more like the name of a property than the name of a method, and thus likely to be unique among all the cases. Even when cases are distinguished using only associated value labels, it simply means that the corresponding case-patterns must include those labels; we should not feel required to force that burden on all other case-patterns purely to achieve consistency with this presumably-unusual style.</pre></blockquote><pre class="" style="white-space: pre-wrap;"><blockquote type="cite" class="">Accordingly, while it needs to be possible to include associated value labels in a case-pattern, and in some situations it may be wise to include them, the core team believes that requiring associated value labels would be unduly onerous.</blockquote></pre><div class=""><br class=""></div></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">This sounds fine in principle, but I believe it is inconsistent with the goals of the proposal and doesn’t actually normalize much about the existing pattern matching process. As it stands, labels may be omitted from patterns because Swift’s philosophy before this proposal is that associated values in enum cases were conceptually tuples. With the addition of default arguments, the ability to overload case names with differing associated value labels, and making the labels part of the API name, there is no reason we should allow tuple-like behavior in just this one case.</div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><blockquote type="cite" class=""><pre class="" style="white-space: pre-wrap;">While an associated-value label...</pre></blockquote><div class=""><br class=""></div></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">While it is true that a user often has a domain-specific intention for variables created during the destructuring process, the labels do not distract from the original purpose of the API and the user is still free to provide whatever name they see fit.</div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><blockquote type="cite" class=""><pre class="" style="white-space: pre-wrap;">Therefore this risk is somewhat over-stated, and of course the programmer should remain free to include labels for cases where they feel the risk is significant...</pre></blockquote><div class=""><br class=""></div><div class="">This is phrased as a matter of choice, in practice this is perplexing. Recall an earlier rejected pattern:</div><div class=""><br class=""></div><div class=""><div class="" style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"><span class="" style="color: rgb(186, 45, 162);">enum</span> Foo {</div><div class="" style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"> <span class="" style="color: rgb(186, 45, 162);">case</span> foo(x: Int, y: Int)</div><div class="" style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;">}</div><div class="" style="color: rgb(0, 132, 0); font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""> </span><span class="" style="color: rgb(186, 45, 162);">case</span><span class=""> </span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""> .foo(x, y: y) {} </span>// Bad! Missing label ‘x'</div></div><div class="" style="color: rgb(0, 132, 0); font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;"><br class=""></div></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">From the user’s perspective, it is obvious what should happen: Either they did, or did not, intend to match labels. From the compiler’s perspective this is a proper ambiguity. Did the user intend to provide a “more meaningful name” and hence meant to elide the label, or did the user intend to match all the labels but forgot or deleted one? It is not obvious why, if we’re making the distinction, we should assume one way or the other. This case only gets worse when we must diagnose intent if the case is also overloaded by base name.</div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">I don’t see how it is "unduly onerous” to teach code completion to suggest the full name of an enum case everywhere or to create diagnostics that always insert missing labels in patterns to correct the user’s mistake. Freedom of choice is, in this case, only making a hard problem harder.</div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><blockquote type="cite" class=""><pre class="" style="white-space: pre-wrap;">It is likely that cases will continue to be predominantly distinguished by their base name alone...</pre></blockquote><div class=""><br class=""></div><div class="">This makes sense given the current state of the world, but under this proposal we fully expect users to be overloading that base name and writing more and more ambiguous patterns. We should encourage disambiguating these cases with labels as a matter of both principle and QoI. </div></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">A pattern is meant to mirror the way a value was constructed with destructuring acting as a dual to creation. By maintaining the structure of the value in the pattern, labels included, users can properly convey that they intend the label to be a real part of the API of an enum case with associated values instead of just an ancillary storage area. Further, we can actually simplify pattern matching by making enum cases consistent with something function-like instead of tuple-like.</div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">To that end, I'd like the rationale and the proposal to be amended to require labels in patterns in all cases.</div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">Thoughts?</div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; margin: 0px; line-height: normal;">~Robert Widmann</div><div class=""><br class=""></div></div></div></div></div></div></div></div>______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-evolution</a><br class=""></blockquote></div><br class="">______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailma<wbr class="">n/listinfo/swift-evolution</a><br class=""><br class=""></blockquote></div><br class=""></div>______________________________<wbr class="">_________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-<wbr class="">evolution</a><br class=""></div></blockquote></div></div></div><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div></blockquote></div></blockquote></div></blockquote></div><br class=""></body></html>