<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Thanks. I already planned to do a revision to address these questions, which all came up during the review.</div><div>On Feb 22, 2017, at 11:27 AM, John McCall <<a href="mailto:rjmccall@apple.com">rjmccall@apple.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div><blockquote type="cite" class=""><div class="">On Feb 21, 2017, at 4:43 AM, Daniel Duan via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><div class=""><div dir="auto" class=""><div class="">My apologies for misunderstanding.</div><div class=""><br class=""></div><div class="">Would it be better to add the anonymous case feature in a separate proposal? It stands alone as a new addition to enum. The intent for this proposal is bringing enum's syntax closure to other part of Swift.<br class=""></div></div></div></blockquote><div><br class=""></div>The core team met and talked about SE-0155 today, even though we're not quite done with the review period, and here's where we stand.</div><div><br class=""></div><div>SE-0155 is being returned for revision. Consensus appears to be strongly in favor of requiring argument labels (if provided) to be enforced on "call" sites. However, the core team feels that the proposal needs revision in the following ways:</div><div> - Are internal argument names syntactically allowed in a case declaration?</div><div> - Can cases with the same base name be overloaded by argument label? If so, is a pattern match using just the bare name ambiguous or does it match both cases?</div><div> - Can cases with the same name (using the same rule as above) be overloaded by argument type? If so, how are they disambiguated in pattern matches?</div><div> - Do pattern matches require argument labels to be given along with value patterns, e.g. "case .valid(value: let value)", or is there some way to shorten this? If the latter, what are the rules for that?</div><div> - Are you proposing anonymous cases, and if so, what are the language rules for them?</div><div> - The proposal makes a claim about layout efficiency; please either discuss this claim or remove it.</div><div><br class=""></div><div>John.</div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><br class=""><div class="">Daniel Duan</div>Sent from my iPhone</div><div class=""><br class="">On Feb 21, 2017, at 1:15 AM, Dave Abrahams via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div class="">I had not intended for _ to be an ordinary identifier, but as a way of spelling the empty case name. Ambiguous cases, not distinguished by either full name or payload type, would be errors. How to construct anonymous cases? I guess it would be MyEnum(expression)<br class=""><br class=""><div class="">Sent from my moss-covered three-handled family gradunza</div></div><div class=""><br class="">On Feb 19, 2017, at 2:52 PM, Daniel Duan <<a href="mailto:daniel@duan.org" class="">daniel@duan.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 19, 2017, at 11:49 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 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=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Feb 18, 2017, at 10:49 PM, Dave Abrahams 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 dir="auto" class=""><div class="">I'm on vacation and don't have time for a full review right now, but I am concerned that wild this proposal would make enums more<span class="Apple-converted-space"> </span><span class="" style="background-color: rgba(255, 255, 255, 0);">general and </span>uniform with the rest of the language , they also would become much more awkward for common use cases. I have recently been very pleased that I didn't have to supply labels in switch statements where the label name would simply have matched the name of the variable to be bound. This looks needlessly verbose:</div><div class=""><br class=""></div><div class=""> case .valid(value: let value, resumptionPoint: let resumptionPoint):</div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><br class=""></div><div class="">I cannot imagine a real life use case where one would have labels in the case and desire to bind associated values to variables having different names than the labels.<br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">I agree with this, but I think it’s an issue we can solve (perhaps as an amendment to this proposal).</div><div class=""><br class=""></div><div class="">First, I think Brent’s idea of introducing an argument label that can be distinct from the “property” name of the case is a good one. I think we should do this. It takes the parallel with function signatures even further.</div><div class=""><br class=""></div><div class="">Second, we should allow the “property” name to be `_`. This would mean no label can be used when matching:</div><div class=""><br class=""></div><div class=""><div dir="auto" class=""><div class="">case valid(value _: ValueType, resumptionPoint _: PointType)</div><div class=""><br class=""></div><div class="">Third, I think we should also allow suers to elide the label if they either discard the value with `_` or bind a name that is identical to the label, so we might have:</div><div class=""><br class=""></div><div class="">// declaration:</div><div class="">case valid(externalCasConstructorLabel value: ValueType, externalCaseConstructorLabel resumptionPoint: PointType)</div><div class=""><br class=""></div><div class="">// match ok:</div><div class=""><div dir="auto" class=""><div class="">case .valid(let value, let resumptionPoint):</div><div class=""><br class=""></div><div class=""><div class="">// error, names do not match:</div><div class=""><div dir="auto" class=""><div class="">case .valid(let foo, let bar):</div><div class=""><br class=""></div><div class=""><div class="">// ok, label is used:</div><div class=""><div dir="auto" class=""><div class="">case .valid(value: let foo, resumptionPoint: let bar):</div></div></div></div></div></div></div></div></div></div></div><div class=""><br class=""></div><div class="">This follows the behavior of function signatures very closely. The external label is used to provide context for the argument at the call site (of the case constructor). The internal name is used to bind a name to the value that is used by code that works with the value. </div><div class=""><br class=""></div><div class="">The only exception here is that because the usage site is distant from the case declaration it may wish to use a different name. We allow that, but only if the “internal name” is also used in the pattern. This preserves the ability of a reader of the code to see the name / meaning of the associated value as it was declared by the enum in addition to the name that might make more sense for use in the local context.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><br class="">Secondly, I can't imagine a case where one would want to use the same case basename and different labels. The very common use case where the types of associated values completely distinguish the case and one would rather not have to supply a case name at all is completely unaddressed. If my quick read is not mistaken, this proposal makes it legal for cases to have different<span class="Apple-converted-space"> </span><i class="">complete names</i> (including base name and labels), but doesn't make it legal to have the same full name (which I would love to be "_" or missing in some cases) with different associated value types. If we were truly following the precedent set by function signatures, wouldn't that be possible too?</div></div></div></blockquote><div class=""><br class=""></div><div class="">+1. I think this makes a lot of sense. It completes the parallel of cases with overloaded functions.</div><div class=""><br class=""></div><div class="">I think anonymous cases are a really good idea. I discuss those quite a bit in the value subtyping manifesto I shared last week (I’d love to hear your thoughts on it if / when you have time to take a look).</div><div class=""><br class=""></div><div class="">How would you propose that values of anonymous cases be constructed and matched? My solution is to allow them to be constructed by implicit conversion from the associated value type to the enum type and matched by a cast pattern. Is that what you have in mind? I would *really* love to see this someday...</div></div></div></blockquote><div class=""><br class=""></div><div class="">I can’t speak for Dave obviously. But I think he was merely proposing “overloaded” form of enum options, in which multiple options may share the compound name but with differently associated types. The name “_” would just be a normal identifier in such scenario. So it would also be the contractor’s function name.</div><br class=""><blockquote type="cite" class=""><div class=""><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=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""></div><div class=""><br class=""><div class="">Sent from my moss-covered three-handled family gradunza</div></div><div class=""><br class="">On Feb 17, 2017, at 5:26 PM, John McCall <<a href="mailto:rjmccall@apple.com" class="">rjmccall@apple.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class="">Hello Swift community,<br class=""><br class="">The review of "SE-0155: Normalize Enum Case Representation" begins now and runs through next Friday, February 26th. The proposal is available here:<div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md</a><div class=""><br class=""></div><div class="">Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at</div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div><div class="">or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:</div><div class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>Proposal link: <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0155-normalize-enum-case-representation.md</a></div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>Reply text</div><div class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>Other replies</div><div class=""><br class=""></div><div class=""><b class="">What goes into a review?</b><br class=""><br class="">The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:<br class=""><br class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>• What is your evaluation of the proposal?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>• Is the problem being addressed significant enough to warrant a change to Swift?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>• Does this proposal fit well with the feel and direction of Swift?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;">        </span>• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br class=""></div><div class=""><br class=""></div>More information about the Swift evolution process is available at <a href="https://github.com/apple/swift-evolution/blob/master/process.md" class="">https://github.com/apple/swift-evolution/blob/master/process.md</a><div class=""><br class=""><div class="">Thank you,<br class=""><br class="">John McCall<br class="">Review Manager</div></div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution-announce mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution-announce@swift.org" class="">swift-evolution-announce@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution-announce" class="">https://lists.swift.org/mailman/listinfo/swift-evolution-announce</a></span><br class=""></div></blockquote></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><br class=""></div></blockquote></div><br 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;"><span 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; float: none; display: inline !important;" class="">_______________________________________________</span><br 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=""><span 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; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br 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=""><a href="mailto:swift-evolution@swift.org" 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;" class="">swift-evolution@swift.org</a><br 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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" 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;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></blockquote></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></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">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></blockquote></body></html>