<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 1, 2019, at 6:20 AM, Michael Platings via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); 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; text-decoration: none;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">Hi all,<o:p class=""></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">As application of the naming rules are currently under discussion [1] this seems like a good time to bring this up:<o:p class=""></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">The current variable naming rule [2] states: Variable names should be nouns (as they represent state). The name should be camel case, and start with an upper case letter (e.g. Leader or Boats).<o:p class=""></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">I'm a relatively new arrival to the LLVM codebase and I want to follow the rules wherever I can, but I humbly submit that this rule is suboptimal for readable code.<o:p class=""></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=""><o:p class=""></o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">The rationale given at the time this rule was added was "document the prevailing convention" [3].</div></div></div></blockquote><br class=""></div><div>I completely agree with you that our variable naming rule is broken. This discussion has been brought up before (e.g. <a href="http://lists.llvm.org/pipermail/llvm-dev/2014-October/077685.html" class="">http://lists.llvm.org/pipermail/llvm-dev/2014-October/077685.html</a>) and hasn’t made any progress - people seem to not be willing to make a change, e.g. saying "the cure is worse than the disease". I’m personally in favor of Nick’s proposal (linked above) which makes variable names and function names be lower camel case. </div><div class=""><br class=""></div><div class="">The Swift language world (a developer community several orders of magnitude larger than LLVM’s) uses this convention very successfully and people seem very happy with it. Swift also has a very carefully considered API design guide (<a href="https://swift.org/documentation/api-design-guidelines/" class="">https://swift.org/documentation/api-design-guidelines/</a>), which applies quite well to C++ APIs as well. If you haven’t seen it, it is worth a look.</div><div class=""><br class=""></div><div class="">Using camel case for one thing and snake case for another is too weird IMO.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Even if the community does not have the appetite to do a huge scale renaming of all the things in LLVM, it would be interesting to carve out an exception for new code being written, refactored, or potentially for use in new subprojects.</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div></body></html>