local variable naming convention
Gary Willoughby
dev at nomad.so
Fri Dec 20 03:23:08 PST 2013
On Friday, 20 December 2013 at 09:30:08 UTC, bearophile wrote:
> kdmult:
>
>> this(int x, int y)
>> {
>> this.x = x;
>> this.y = y;
>> }
>
> In D I prefer:
>
> this(int x_, int y_) {
> this.x = x_;
> this.y = y_;
> }
>
> Bye,
> bearophile
I tend to use the opposite for private/protected member variables
as per the d style guidelines located here:
http://dlang.org/dstyle.html.
"Unless listed otherwise below, names should be camelCased (this
includes all variables). So, names formed by joining multiple
words have each word other than the first word capitalized. Also,
names do not begin with an underscore ‘_’ unless they are
private."
Example:
this(int x, int y)
{
this._x = x;
this._y = y;
}
More information about the Digitalmars-d-learn
mailing list