observation: D getting a bit complex

Jack Stouffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 29 23:27:07 PDT 2015


On Sunday, 30 August 2015 at 02:42:30 UTC, Spacen Jasset wrote:
> immutable(ElementEncodingType!(ElementType!Range))[] 
> buildPath(Range)(Range segments) if (isInputRange!Range && 
> isSomeString!(ElementType!Range));
> pure nothrow @safe immutable(C)[] buildPath(C)(const(C)[][] 
> paths...) if (isSomeChar!C);

I understand how you feel. When I was learning D, the docs where 
almost impenetrable because of this. But when I got into some of 
the more advanced features of D, I found these explicit function 
signatures invaluable. This essentially tells you that the 
function takes either a range of strings, or it can take 
indefinite number of strings as different arguments.

Also, examples underneath the function signature help new comers 
understand how to call the function without having to parse it.


More information about the Digitalmars-d-learn mailing list