We need better documentation for functions with ranges and templates

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 14 13:11:57 PST 2015


On Monday, 14 December 2015 at 21:02:05 UTC, Ali Çehreli wrote:
> > bool isSameLength(Range1, Range2)(Range1 r1, Range2 r2)
> > if (isInputRange!Range1 && isInputRange!Range2 &&
> !isInfinite!Range1 &&
> > !isInfinite!Range2
> Can we simplify it even more? Just this much:


You know, I think it is a lot more readable already just putting 
in some whitespace.

bool isSameLength
     (Range1, Range2)
     (Range1 r1, Range2 r2)
     if(
         isInputRange!Range1 &&
         isInputRange!Range2 &&
         !isInfinite!Range1 &&
         !isInfinite!Range2
     )
---------------------------------------


Maybe we could run the outputted code through a D source 
formatter?!


Heck, the compiler error messages might be easier to read if it 
formatted with liberal whitespace too, though there is the tiny 
concern there that other tools might expect one error per line... 
but i say meh to that, we already break that rule.


More information about the Digitalmars-d mailing list