observation: D getting a bit complex

Spacen Jasset via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 30 03:42:22 PDT 2015


On Sunday, 30 August 2015 at 07:36:55 UTC, BBasile wrote:
> 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);
>
> this is stodgy, particularly in a console with line wrapping at 
> 80 chars.


To be fair is was the docs page I was reading not a compiler 
diagnostic, but I did get something a bit shorter from the 
compiler once.

It's slighty hard to see that you can give that function a 
string, and that it can return a string like thing -- although on 
that score too I've found I have to use char[] in some places 
instead of string which is to do with immutability, that I've not 
quite worked that out yet either -- It's just a feeling I have 
when looking at this now that it is quite complex.

I only mention this as it was something that I think other people 
may notice too, when starting out, or coming back to D.

Maybe I've just been doing too much python recently.





More information about the Digitalmars-d-learn mailing list