"Good PR" mechanical check

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 13 07:07:28 PST 2016


On Wed, Jan 13, 2016 at 07:53:45AM +0000, Brian Schott via Digitalmars-d wrote:
> On Wednesday, 13 January 2016 at 05:19:36 UTC, H. S. Teoh wrote:
> >There are also some (smaller) examples in std.range, such as in
> >transposed(), where nested arrays are formatted like matrices in
> >order to make it clear what the function is trying to do. I'm almost
> >certain dfmt (or any mechanical formatting tool) will completely ruin
> >this.
> 
> It will. There's a solution in the form of special comments:
> 
> // dfmt off
> auto treeStructure = [
>     node(0, 0),
>         node(1, 0),
>         node(2, 0),
>             node(10, 2),
>         node(3, 0)
> ];
> // dfmt on
> 
> // dfmt off
> stuff.map!(a => complicatedFunction(a, 100) * 20)
>      .filter!(a => a < 2_000 && a %3 == 0)
>      .sum();
> // dfmt on
[...]

Fair enough, but will this work in ddoc'd unittests, where you don't
necessarily want those dfmt comments to make it into the generated docs?

But, case in point, won't UFCS chains be poorly formatted in general? Or
are there dfmt comments that can switch dfmt to "UFCS mode"? Or does it
detect UFCS chains and format accordingly?


T

-- 
To err is human; to forgive is not our policy. -- Samuel Adler


More information about the Digitalmars-d mailing list