D naming style?

Jeremie Pelletier jeremiep at gmail.com
Sat Sep 5 21:20:29 PDT 2009


Michel Fortin Wrote:

> On 2009-09-04 21:07:01 -0400, Jarrett Billingsley 
> <jarrett.billingsley at gmail.com> said:
> 
> > On Fri, Sep 4, 2009 at 8:42 PM, Ali Cehreli<acehreli at yahoo.com> 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.
> 
> Here it is: <http://www.digitalmars.com/d/2.0/dstyle.html>.
> 
> I've also written a guide on how to name things, but, as far as I know, 
> nobody is following it at the moment. Hopefully it can be improved and 
> serve as the basis for naming things in Phobos (although I'm beginning 
> to be skeptical about that). See 
> <http://prowiki.org/wiki4d/wiki.cgi?DProgrammingGuidelines>.
> 
> -- 
> Michel Fortin
> michel.fortin at michelf.com
> http://michelf.com/
> 

I just read your guide, it follows a lot of the logic I already use myself. But I think you need more explanations to justify your rules; I believe it is way easier for someone to remember something if they know and understand why they should remember it.

Also, about your bit on wchar vs wchar_t. wchar in D is fixed to 16bit while wchar_t is 16bit on Windows but 32bit on linux, some people care about differences like that, or learn them the hard way like I did: from segmentation faults!



More information about the Digitalmars-d mailing list