On Sunday, September 11, 2011 22:29:42 Don wrote:
> On 09.09.2011 17:49, Andrei Alexandrescu wrote:
> > http://www.reddit.com/r/programming/comments/k7pwu/eclipse_default_line_
> > length_of_80_chars_outdated/
> > 
> > 
> > Andrei
> 
> Interesting to me was the quote from Linus, saying that indentation
> depth should never exceed 3. If you accept that, then 80 characters
> seems perfectly reasonable.
> 
> Pretty clearly, the language design has a big influence on the maximum
> indent level of a typical program. I would say that unless the language
> has considered a low level of indenting to be desirable, 80 characters
> isn't enough. For example, in D, a member function of a class inside a
> template wrapped in a version statement already uses three levels of
> indentation.

Agreed. The combination of more descriptive function and class/struct names 
(even without the insanely large ones that Java sometimes has) and multiple 
levels of indentation pretty much fries 80 characters as a reasonable limit in 
many cases. Without many levels of indentation and shorter symbol names, 80 
characters is plenty. But with a language like D, where it's easy to have 
multiple levels of indentation and where we're trying to have reasonably 
descriptive names, 80 characters is often too limiting.

But the decision to stick to a soft limit of 80 and a hard limit of 120 in 
Phobos seems to be pretty solid overall. Once in a while 120 is annoyingly 
short but that's fairly rare, and a decent chunk of the time 80 characters is 
enough, so the code that needs to go over 80 characters can, and much of the 
rest manages to stick within 80. It seems to have made for a solid compromise.

> IMHO, the comparisons with newspaper columns are flawed, because
> newspapers don't use indentation in the same way that code does.
> It seems to be a trade-off: more indentation improves readability, but
> it also increases line length, which reduces readability...

Agreed. Maybe if you were arguing 80 characters from the beginning of text on 
the line, but with indentation, that newspaper comparison falls apart 
completely. It's good to keep it in mind in that it's evidence that making 
lines too long causes problems, but the actual circumstances are different, so 
the exact rules that are used with newspapers don't really translate over.

- Jonathan M Davis

Reply via email to