Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

Michael Mossey mpm at alumni.caltech.edu
Tue Apr 21 17:53:58 EDT 2009



Robert Greayer wrote:
> 
> But the discussion is about a coding standard -- surely if I claimed to like to
> have 4 windows side by side, that wouldn't be a good reason to reduce the standard
> to 40 columns?  Being able to read one line 'at a glance' seems to me to be
> improved if that line contains the complete equation, rather than just a fragment.
> Comprehension of a group of related equations can be improved if they all fit on
> one screen (vertically).  Some code that I've written is intended to look like
> (and function as) rewrite rules  and looks vastly better with pattern and
> replacement all on the same line.  All the arguments can cut both ways -- for
> those who like coding with windows side by side, what about those who like coding
> with one window above another? Coding style is very situational, but the 80
> character standard came about due to a once-ubiquitous device limitation (which no
> longer exists).
> 
> The *real* purpose of a coding standard, of course, is to give people something to
> argue over when they could be actually doing something more productive.  So in the
> end, it's all good, I suppose.

80 characters may be the device limitation from long ago, but there are other reasons 
to keep lines from getting too long, as have been mentioned... the ease of reading 
vertically, the common use of 80-char windows that can be fit side-by-side. As far as 
arguments "cutting both ways," I think it's really a Goldilocks question. Some code 
has lines that are clearly too long to be practical (because they will look ugly as 
they wrap on most people's editors), and 40 characters is clearly too short. 
Somewhere in the middle is "just right." Now, we may disagree on what "just right" 
is, but I just want to establish that the various arguments for longer or shorter 
lines can be regarded as forces that tug the coding standard in one direction or the 
other, and I think it's valuable to look for the equilibrium.

I think 80 characters is a decent compromise. 80-character windows seem to be very 
common. At work everyone uses them, and as monitors got wider, they put windows 
side-by-side. Seems like a common practice.

Mike



More information about the Haskell-Cafe mailing list