Style guide is very inconsistent
maik klein via Digitalmars-d
digitalmars-d at puremagic.com
Mon Nov 16 06:09:43 PST 2015
I am a very new D user and I almost always try to mirror the
"official" style guide if one is available.
http://dlang.org/dstyle.html
I have written the following function
template Contains(C...){
template Any(T...){
import std.meta: anySatisfy;
static if(T.length == 0){
enum Any = false;
}
else{
enum Any = ContainsImpl!T;
}
template ContainsImpl(T...){
enum bool isSameComponent(Comp) = is(Comp == T[0]);
static if(T.length == 1){
enum ContainsImpl = anySatisfy!(isSameComponent,C);
}
else{
enum ContainsImpl = anySatisfy!(isSameComponent,C) &&
ContainsImpl!(T[1..$]);
}
}
}
}
No idea how I should type it contains!c.any!T or contains!c.Any!T
Which lead me to have a look at phobos
For example
template Filter(alias pred, TList...)
vs
template anySatisfy(alias F, T...)
Are aliases now written in upper or lower camelCase? Should I use
T... or TList... for variadics if I can't name them better?
or
private template GenericReplace(args...)
Why are the variadics written in lower case?
More information about the Digitalmars-d
mailing list