[phobos] excessive vertical spacing?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Jan 28 14:00:39 PST 2013
Quote:
@property SysTime timeLastModified()
{
_ensureStatDone();
return SysTime(unixTimeToStdTime(_statBuf.st_mtime));
}
I think this is excessive. What really trips me up however (and
there's plenty examples of it in Phobos) is this:
if (expression1)
{
// ...
}
else if (expression2)
{
// ...
}
if (expression3)
{
// ...
}
It's really hard to know whether the programmer actually meant for the
last `if` statement to be on its own line or if it's there by accident
and should have been an `else if`.
In fact it also makes it harder to add code, because you could easily
mistake this whole section as being an if-else-if chain, and add code
which is wrong, for example:
if (expression1)
{
// ...
}
else if (expression2)
{
// ...
}
if (expression3)
{
// ...
}
else if (expression 4)
{
// broken code expecting expression1 is not true because
// the programmer failed to see the else-if chain is broken at
// expression 2
}
That is error-prone, whereas just adding blank lines is merely an inconvenience.
More information about the phobos
mailing list