Phango - questions

Sean Kelly sean at f4.ca
Mon Nov 19 07:45:05 PST 2007


Christopher Wright wrote:
> Kris wrote:
>> Er, why don't you give us some examples, Alix? That's what we'd be 
>> asking you for on IRC.
> 
> I'll bite. Why do you use mixedCamelCase for both member variables and 
> methods, and the same style for both private and public fields?

This is what the D style guide suggests.

 > This is
> a stylistic topic that almost no one touches, probably because Tango 
> conventions seem to be lifted wholesale from Java and that's how Java 
> does it, but I find it a bit confusing and annoying when I'm reading 
> someone else's code.

For member variables, I personally prefix the non-public variables with 
"m_" and non-public static member variables with "sm_".

> I would at least prefix private variables with an underscore, if I were 
> setting the style. But if I want to muck about with Tango's internals, I 
> can suck it up.

I avoid leading underscore prefixes because they are reserved for C/C++ 
standard library use.  It's easiest to just avoid this format entirely 
than risk the rare chance of a collision.


Sean



More information about the Digitalmars-d mailing list