Naming convention for template parameters

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Jul 15 16:09:50 PDT 2013


On 07/16/2013 01:02 AM, H. S. Teoh wrote:
> I generally use R 'cos it's less typing and I'm lazy

... ditto ... :-)

> but Walter has been recently of the opinion that a more descriptive name
> is necessary for ddoc purposes, e.g., MyStruct(InputRange)(InputRange r)
> is much more self-documenting than MyStruct(R)(R r).

Yes, that was my main consideration for this case.  I'm worried about the
potential for clashes with other elements of the namespace, though.

I'm thinking in particular of the tendency to use Random as the template
parameter name for a random number generator, when Random is actually an alias
for the default RNG type.  I've proposed a blanket rewrite of such template
parameter names to Rng: http://d.puremagic.com/issues/show_bug.cgi?id=10434

Particular context is that I'm trying to tidy up/standardize some bits of
std.random and I'd like my standards to be future-proof. :-)


More information about the Digitalmars-d-learn mailing list