Why I'm skeptical of auto-formatting

JN 666total at wp.pl
Fri May 3 07:48:14 UTC 2019


On Thursday, 2 May 2019 at 22:44:51 UTC, H. S. Teoh wrote:
> The meaning of the first line is unimportant to the topic at 
> hand (though guesses are welcome :-P).  The main point here is 
> that any auto-formatting tool I know of would not only 
> completely destroy the elegance of the above test, but also 
> pretty much remove all visual traces of why exactly this 
> particular case is being tested and why the given values are 
> the correct ones, as opposed to some arbitrary random sequence 
> of integers.
>
>
> T

I love autoformatting. I have my VSCode setup to run dfmt on the 
code on each save, so that my code is formatted properly each 
time. It also helps me to find missing or misaligned braces, 
because dfmt goes crazy in such cases and it's easy to spot 
something is wrong. Also it allows me to type code very quickly, 
because I don't have to bother with newlines, indentation, I just 
write my code any way I want, Ctrl+S and I have it all nice and 
clean.

Yes, the case you mentioned is an edge case, where autoformatting 
doesn't help. But I rarely encounter such case in my own code. If 
I have to align arrays like this, I usually read them from a 
separate file, so that the code formatter can't touch it.


More information about the Digitalmars-d mailing list