[phobos] excessive vertical spacing?

Andrei Alexandrescu andrei at erdani.com
Mon Jan 28 13:39:10 PST 2013


On 1/28/13 3:51 PM, Dmitry Olshansky wrote:
> I hate empty lines after "variable declarations or before or after if
> blocks".
> D isn't Fortran and variables typically get defined right before being used
> and go out of scope as soon as possible.

I agree and was about to submit a similar protest but gave up on that.

> Distinguishing if statements is
> frankly strange in general, as fonts and editors provide enough of control
> to make these stand out.
> Same goes for putting a line before return statement - the return
> keyword is already
> highlighted, and pretty much always expected. Most of the time (YMMV)
> it's either
> an early return as (if+return) or the good old return at the end of
> function.
>
> I'd say saved vertical space adds more clarity especially with modern
> wide-screen laptops ;)
> And quite a lot of it is already wasted since we have "brace on its own
> line" as a style guideline.
>
> I don't mind (and in fact like) empty lines that indicate semantic
> blocks or steps inside of a function.
> I'd even put a comment in such a case. One of examples is the
> exception-safe code as there
> is always a line between the stuff that may fail with exception (action)
> and the stuff that shall never do (commit).

I agree with all of the above. Let me add that the need for vertical 
blank lines may sometimes reveal the opportunity of refactoring into 
smaller functions.


Andrei


More information about the phobos mailing list