<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 10/13/2014 03:04 PM, Nick Kledzik
      wrote:<br>
    </div>
    <blockquote
      cite="mid:756D50BE-84CE-42ED-9175-E84BBBA7935C@apple.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      I’d like to discuss revising the LLVM coding conventions to change
      the naming of variables to start with a lowercase letter.  This
      should not be a discussion on the pain of such a transition, or
      how to get from here to there, but rather, if there is a better
      place to be.  <br>
    </blockquote>
    +1, leaving aside all practicalities of migration<br>
    <blockquote
      cite="mid:756D50BE-84CE-42ED-9175-E84BBBA7935C@apple.com"
      type="cite"><font color="#0f61c8"><br>
      </font>My arguments for the change are:<br>
      <font color="#0f61c8"><br>
      </font>1. No other popular C++ coding style uses capitalized
      variable names.  For instance here are other popular C++
      conventions that use camelCase:<br>
      <font color="#0f61c8"><br>
      </font>   <a moz-do-not-send="true"
        href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml"
        class="">http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml</a><br>
         <a moz-do-not-send="true"
        href="http://www.c-xx.com/ccc/ccc.php" class="">http://www.c-xx.com/ccc/ccc.php</a><br>
         <a moz-do-not-send="true"
        href="http://geosoft.no/development/cppstyle.html" class="">http://geosoft.no/development/cppstyle.html</a><br>
      <font color="#0f61c8"><br>
      </font>And, of course, the all-lower-case conventions (e.g. C++
      ARM) don’t capitalize variable names.  In addition, all the common
      C derived languages don’t use capitalized variable names (e.g.
      Java, C#, Objective-C).<br>
      <font color="#0f61c8"><br>
        <br>
      </font>2. Ambiguity.  Capitalizing type names is common across
      most C++ conventions.  But in LLVM variables are also capitalized
      which conflates types and variables.  Starting variable names with
      a lowercase letter disambiguates variables from types. For
      instance, the following are ambiguous using LLVM’s conventions:<br>
      <font color="#0f61c8"><br>
      </font><span class="Apple-tab-span" style="font-family: Monaco;
        font-size: x-small; white-space: pre;"> </span><span
        style="font-family: Monaco; font-size: x-small;">Xxx Yyy(Zzz);
         // function prototype or local object construction?</span><br>
      <span class="Apple-tab-span" style="font-family: Monaco;
        font-size: x-small; white-space: pre;"> </span><span
        style="font-family: Monaco; font-size: x-small;">Aaa(Bbb);    
         // function call or cast?</span><br>
      <font color="#0f61c8"><br>
        <br>
      </font>3. Allows name re-use. Since types and variables are both
      nouns, using different capitalization allows you to use the same
      simple name for types and variables, for instance:<br>
      <font color="#0f61c8"><br>
      </font><span class="Apple-tab-span" style="font-family: Monaco;
        font-size: x-small; white-space: pre;"> </span><span
        style="font-family: Monaco; font-size: x-small;">Stream  stream;</span><br>
      <font color="#0f61c8"><br>
        <br>
      </font>4. Dubious history.  Years ago the LLVM coding convention
      did not specify if variables were capitalized or not.  Different
      contributors used different styles.  Then in an effort to make the
      style more uniform, someone flipped a coin and updated the
      convention doc to say variables should be capitalized.  I never
      saw any on-list discussion about this.<br>
      <font color="#0f61c8"><br>
        <br>
      </font>5. Momentum only.  When I’ve talked with various
      contributors privately, I have found no one who says they likes
      capitalized variables.  It seems like everyone thinks the
      conventions are carved in stone...  <br>
      <font color="#0f61c8"><br>
        <br>
      </font>My proposal is that we modify the LLVM Coding Conventions
      to have variable names start with a lowercase letter.  <br>
      <font color="#0f61c8"><br>
      </font><span style="font-family: Monaco; font-size: x-small;">Index:
        CodingStandards.rst</span><br>
      <span style="font-family: Monaco; font-size: x-small;">===================================================================</span><br>
      <span style="font-family: Monaco; font-size: x-small;">---
        CodingStandards.rst</span><span class="Apple-tab-span"
        style="font-family: Monaco; font-size: x-small; white-space:
        pre;"> </span><span style="font-family: Monaco; font-size:
        x-small;">(revision 219065)</span><br>
      <span style="font-family: Monaco; font-size: x-small;">+++
        CodingStandards.rst</span><span class="Apple-tab-span"
        style="font-family: Monaco; font-size: x-small; white-space:
        pre;"> </span><span style="font-family: Monaco; font-size:
        x-small;">(working copy)</span><br>
      <span style="font-family: Monaco; font-size: x-small;">@@ -1073,8
        +1073,8 @@</span><br>
      <span style="font-family: Monaco; font-size: x-small;">   nouns
        and start with an upper-case letter (e.g. ``TextFileReader``).</span><br>
      <span style="font-family: Monaco; font-size: x-small;"> </span><br>
      <span style="font-family: Monaco; font-size: x-small;"> *
        **Variable names** should be nouns (as they represent state). 
        The name should</span><br>
      <span style="font-family: Monaco; font-size: x-small;">-  be camel
        case, and start with an upper case letter (e.g. ``Leader`` or</span><br>
      <span style="font-family: Monaco; font-size: x-small;">- 
        ``Boats``).</span><br>
      <span style="font-family: Monaco; font-size: x-small;">+  be camel
        case, and start with a lower case letter (e.g. ``leader`` or</span><br>
      <span style="font-family: Monaco; font-size: x-small;">+ 
        ``boats``).</span><br>
      <span style="font-family: Monaco; font-size: x-small;">   </span><br>
      <span style="font-family: Monaco; font-size: x-small;"> *
        **Function names** should be verb phrases (as they represent
        actions), and</span><br>
      <div class="">
        <div class="" style="word-wrap: break-word; -webkit-nbsp-mode:
          space; -webkit-line-break: after-white-space;">
          <div class="">
            <div class="" style="margin: 0px;"><font class=""
                face="Monaco" size="1">   command-like function should
                be imperative.  The name should be camel case,</font></div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>