On 80 columns should (not) be enough for everyone

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jan 31 10:02:18 PST 2011


On 1/31/11 11:54 AM, Ulrik Mikaelsson wrote:
> FWIW: Here's my two cents; (Non-Phobos participant, so feel free to
> click delete now)
>
> I'm not sure whether text-books and program-code are really comparable
> in this respect. When reading books I hardly put much attention to
> each particular word, while in computer-code, each token is very
> significant. The "flow" of reading is simply different. If it weren't,
> we would hardly use hard line-breaks at all, just concatenate
> statements like we concatenate sentences in text, and use<your word
> processor>  to format code. Especially, we would not use monospaced
> fonts and care about "columns".

Well the fact of the matter is that style used in books is very 
influential. People do copy book samples into code and continue working 
in the same style from them. I've been asked for (and released) the 
source code of all snippets in TDPL.

> I would rather like to hear whether any mathematicians ever insert
> hard-breaks into their equations just "to not get them too wide".

I'm not sure I can qualify as a mathematician but my research is very 
math-heavy. In my thesis 
(http://erdani.com/research/dissertation_color.pdf) I frequently 
inserted line breaks even when not technically necessary, check e.g. eq. 
2.16 on page 12.

> Personally, I've been a long time on the fence regarding strict
> line-length, and my current position is:
>   90 columns is the rule of thumb. 80 columns is often hard to fit
> using readable names, but 90 columns generally works.

Seems reasonable. Since both Jonathan and Don prefer longer lines, I'm 
now more inclined to increase and/or soften the recommended limit for 
Phobos.


Andrei


More information about the Digitalmars-d mailing list