little thing - D and phobos naming conventions

Brian Hay bhay at construct3d.com
Fri Oct 27 01:54:40 PDT 2006


I'm new to D so please forgive my ignorance if indeed that's what it is.

One thing I like about C#.NET and Java is the consistency and 
readability of language keywords and framework classes and methods etc, 
despite the extra verbosity. These languages conform to strict, verbose 
naming conventions e.g. upper camel case for classes, lower camel case 
for methods and variables.

Having said that, I still prefer D (and the development philosophy 
behind it) but, for example, some library method names are inconsistent 
and mostly (but not always) follow the legacy C/C++ conventions of 
lowercase everything and abbreviate to sometimes incoherent acronyms 
wherever possible. I think this makes code less readable, but I know 
this is a subjective opinion.


Example inconsistencies:

   phobos.std.string

     toSting() (lower camel case)
     tolower() (all lower case)

     iswhite() (all lower case)
     isNumeric() (lower camel case)
     inPattern() (lower camel case)

     tr() not immediately clear what these abbreviations mean
     atoi() what is the aversion to a little more verbosity?


Other than the "D Style Guide" doc for coders (which phobos doesn't seem 
to conform to), is there a particular naming convention for the D 
language and standard libraries themselves and what is the rationale 
behind it? (I'm presuming it's to make the language more familiar to 
C/C++ coders)

Everything else about D is so cool, modern, well-designed and 
cutting-edge but some of this naming is so "old school". I know I'm 
being anal and this shouldn't get on my nerves ... but alas it does.


Brian.



More information about the Digitalmars-d mailing list