On Fri, Sep 4, 2009 at 8:42 PM, Ali Cehreli<[email protected]> wrote: > Is there a common(-ish) naming style for D? > > - camel case or underscores within words of names? > > - type names begin with capital? > > - underscore before or after member names? > > - enum values lowercase? > > - constant names? > > - etc.? :) > > Do you have a document that you would like to share?
There is a "D style guide" in the D spec that briefly mentions naming conventions, but I'm not sure how many people use it / are aware of its existence. Most D libraries seem to use camel casing for multi-word names, start types with a capital, start functions/methods with lowercase, and don't put braces on the same line as code. Beyond that, there's a lot of variation. Sometimes enums have ALL_CAPS members, sometimes CamelCased, sometimes lowercased, sometimes even varied within the same library. Constant names are similarly varied. Many people don't indicate class members with any kind of decoration, which .. really irks me ;) but those that do, I've seen _foo, foo_, m_foo, mFoo, and some others. Personally? I hate underscores and use any naming scheme that doesn't use them. I name all types and constants with CapitalNames and members with mFoo.
