D naming style?
Jeremie Pelletier
jeremiep at gmail.com
Sat Sep 5 21:11:09 PDT 2009
bearophile Wrote:
> Jarrett Billingsley:
> > I'm consistently confused by D (and Java and C#) code that doesn't
> > indicate member names, especially when they're named really common
> > things that often conflict with local variables, like "len" or "src"
> > or such. Unless the type is small enough to fit on a single screen,
> > it's easy to forget the member names.
>
> I usually follow Python usage, and use this.fieldName. Is this bad practice in D?
>
> Bye,
> bearophile
I haven't coded in python, but in php members are accessed through $this->fieldName, which is just as ugly. I used to name my member variables like any other variable in D (without accessing them with this.) until I confused myself looking back at D code I wrote a year earlier and not being able to tell which variables were function local and which were from the class, which had a nasty superclass stack. I don't like using 'this' to access every member variable since I view it more as a way to access a member shadowed by a local symbol than as a convention, so I declare my member variables with a '_' prefix.
More information about the Digitalmars-d
mailing list