-- Leo's gemini proxy

-- Connecting to tilde.pink:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;

Returning to 80-character line widths


After years of passively advocating for 115-column lines in source code, I've recently moved back to openly advocating for 80-column limits.

This seems pedantic and tech-y enough to be fit for a gemlog post so here we go.


The main argument for column limits in general are that excessively long lines of text are difficult to read (because we have human eyes), and enforcing a standard makes code less difficult to follow specifically because of uniformity in program structure. There are more niche reasons to prefer or oppose hard limits, but the main argument against them is that modern computers have very large screens so artificially shrinking code's horizontal width is less efficient, because it pushes complexity into the vertical expanse.


The most-repeated counter-argument to "I have a big screen, let me write big lines" is that with uniformly short lines of code you can easily open multiple files at once horizontally on a wide monitor without reflowing which makes it difficult to read. The famous Linus Torvalds posted a (quite famous in its own right) rebuttal of that argument, which I'll link to here:


https://lkml.org/lkml/2020/5/29/1038


The core piece of Torvalds's argument is that 80-column wide terminals are not enforced by hardware on the types of machines that Linux targets (which started out as PC-compatibles).


At the time I first read it, I found the bit about 132-column terminals being not uncommon in the 1980s to be a pretty compelling reason against targeting 80-column lines as a standard to adhere to. For awhile after that I was using 132 columns as my fci limit in Emacs, before eventually switching to 120 (which allows two max-width files to be open side by side with no whitespace on my 15.6" laptop), and ultimately 115 columns, as that allows me to have a treemacs buffer open as well.


115 columns is pretty easy to hit, especially if you (like me) tend to use post-line commentary. There are some languages that lend themselves particularly well to being written "wide", like Lisp, even if you use 3-space indentation like I generally do. However, I rarely feel the need to violate the 115-column rule, as at that point you usually have some syntactic structure which can be cleanly split off.


Well, all of my opinions on this matter have changed pretty much overnight. The reason?


I got a PinePhone!


The PinePhone, with SXMO, by default in landscape mode can display 88 columns in an Emacs buffer. Scrolling through some of my 115-column source code can be painful, as many lines are slightly cut off which makes continuity rough. Trying to zoom out to fit 115 columns on one row makes the kerning screw up pretty bad and the text becomes nearly illegible.


With that in mind, moving forward, I think I'm going to treat 88 characters as a hard limit for when to break a line, and 80 characters as a soft limit. Not because it's "the standard" or anything vague like that, but because it is of immediate practical utility to me with the way that I do my computing...I can't make the PinePhone's screen physically larger, so I'll have to focus on keeping my code thinner.


Also, as I learned when doing some research for this gemlog post, the range between 81 and 88 characters is actually super common: most typewriters back in the day would carriage-return after 87 characters, for example. Also, a U.S. letter-sized paper can fit 85 characters of 10pt font.


I am not going to go around submitting PRs to random projects to change their style guide to use 80-character lines or anything like that. But I do think it feels good to have a concrete reason to hold an opinion in this debate.

-- Response ended

-- Page fetched on Sun May 19 14:34:48 2024