Is phobos too fluffy?

Andrei Alexandrescu SeeWebsiteForEmail at
Thu Sep 17 15:51:18 UTC 2020

As wc -l counts, phobos has some 330 KLOC:

$ wc -l $(git ls-files '*.d') | tail -1
   331378 total

I noticed many contributors are fond of inserting empty lines 
discretionarily, sometimes even in the middle of 2-5 line functions, or 
right after opening an "if" statement. The total number of empty lines:

$ git grep '^$' $(git ls-files '*.d') | wc -l

So Phobos has 11.62% empty lines in it, on average one on every 9 lines 
of code. I find that a bit excessive, particularly given that our coding 
convention uses brace-on-its-own line, which already adds a lot of 
vertical space. Here's the number of lines consisting of only one brace:

git grep '^ *[{}] *$' **/*.d | wc -l

That's 16% of the total. Combined with empty lines, we're looking at a 
27.65% fluff factor. Isn't that quite a bit, even considering that 
documentation requires empty lines for paragraphs etc?

Today's monitors favor width over height and I didn't yet get to the 
point of rotating my monitor for coding purposes. (It's also curved, 
which would make it awkward.) Would it be reasonable to curb a bit on 
the fluff factor? E.g. there should never be two consecutive empty 
lines, and code blocks shorter than x lines should have no newlines inside.

More information about the Digitalmars-d mailing list