Style guide is very inconsistent

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 16 06:26:39 PST 2015


On Monday, 16 November 2015 at 14:09:45 UTC, maik klein wrote:
> Why are the variadics written in lower case?

Per the style guide,

=====
Eponymous Templates

Templates which have the same name as a symbol within that 
template (and instantiations of that template are therefore 
replaced with that symbol) should be capitalized in the same way 
that that inner symbol would be capitalized if it weren't in a 
template - e.g. types should be PascalCased and values should be 
camelCased.
=====

So, whether an eponymous template is camelCased or PascalCased 
depends entirely on what its result is. It's quite possible that 
there are older symbols in Phobos that don't follow those 
guidelines, but most do. However, there are some where it's not 
clear which it should be.

e.g. std.meta.Filter is a funny one, because it works with any 
symbol - be it a type or a value - so it could have gone either 
way, but it was probably targeted primarily at types, so it ended 
up with its name being PascalCased.

But in general, an eponymous template which results in a type is 
supposed to be PascalCased, whereas the others are supposed to be 
camelCased.

Really, pretty much anything that isn't a type is camelCased, 
whereas types are PascalCased. It's just that there a few cases 
that are inherently ambiguous, and there may be some older 
symbols in Phobos which don't properly follow the current style 
guide.

- Jonathan M Davis


More information about the Digitalmars-d mailing list