<div dir="ltr">+1 <span style="font-size:13px">upper camel.</span><div><span style="font-size:13px"><br></span></div><div><span style="font-size:13px">-Van</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 26, 2016 at 10:12 PM, Michel Fortin via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class="">Le 26 févr. 2016 à 15:43, Douglas Gregor via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> a écrit :<br><div><blockquote type="cite"><br><div><div style="word-wrap:break-word">Hi all,<div><br></div><div>As part of the grand API guidelines discussion, there was a lot of support for using lowerCamelCase for enum cases, because they are values in Swift. One unfortunate wrinkle here is that it’s not at all uncommon to have a case named “Default” for an enumeration. One example pulled randomly from GitHub:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><font face="Menlo">enum DispatchQOS {</font></div></div><div><div><font face="Menlo"> case UserInteractive</font></div></div><div><div><font face="Menlo"> case UserInitiated</font></div></div><div><div><font face="Menlo"> case Default</font></div></div><div><div><font face="Menlo"> case Utility</font></div></div><div><div><font face="Menlo"> case Background</font></div></div><div><div><font face="Menlo">}</font></div></div></blockquote><div><br></div><div>If we’re lowerCamelCasting enum cases, this becomes:</div><div><br></div><div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="Menlo">enum DispatchQOS {</font></div><div><font face="Menlo"> case userInteractive</font></div><div><font face="Menlo"> case userInitiated</font></div><div><font face="Menlo"> case `default`</font></div><div><font face="Menlo"> case utility</font></div><div><font face="Menlo"> case background</font></div><div><font face="Menlo">}</font></div><div><font face="Menlo"><br></font></div></blockquote></div><div>Note the back-ticks, which are also needed at the call site:</div><div><br></div><div><font face="Menlo"><span style="white-space:pre-wrap">        </span>func dispatch(priority priority: </font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo"><span style="white-space:pre-wrap">        </span>dispatch(priority: .`default`) { … }</font></div><div><br></div><div>We could allow one to refer to keywords without back-ticks following a “.”, similarly to the way we allow keywords without back-ticks preceding a ‘:’ for argument labels, e.g.:</div><div><br></div><div><div><font face="Menlo"><span style="white-space:pre-wrap">        </span>func dispatch(priority priority: </font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo"><span style="white-space:pre-wrap">        </span>dispatch(priority: .`default`) { … }</font></div></div><div><font face="Menlo"><br></font></div><div>One would still need to use back-ticks in the declaration of the case, but at least uses would be back-tick-free. Thoughts?</div></div></div></blockquote><div><br></div></div></span><div>Another idea is to replace the keyword default with something else. The only place it can occur is within a switch statement, right? We already have a synonym: case _</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><span style="border-collapse:separate;line-height:normal;border-spacing:0px"><div style="word-wrap:break-word"><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px"><div style="word-wrap:break-word"><span style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px"><div style="word-wrap:break-word">-- <br>Michel Fortin</div><div style="word-wrap:break-word"><span style="text-align:-webkit-auto"><a href="https://michelf.ca" target="_blank">https://michelf.ca</a></span></div></span></div></span></div></span></div></div></div></div>
</div>
<br></font></span></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>