5 ms·
Why is this a thing in languages that are not Fortran 77? Why not a 1000 character long line? If I want the editor to overflow it below or show me a scrollbar
by whatever1 5y ago
Why is this a thing in languages that are not Fortran 77?
Why not a 1000 character long line?
If I want the editor to overflow it below or show me a scrollbar should be my choice.
- nine_k 5y agoDiffing an excessively long line is uncomfortable in most tools. A crash dump mentioning the 1000-character line leaves you thinking where in that line the error has happened. The actual limit should be the complexity of one lihe, something like the number of AST nodes in it. But our tools which go back all the way to mechanical teletypes and punched cards are firmly line-oriented. This allows them to be language-agnostic.
- thfuran 5y agoI think it's reasonable to have restrictions on both. Regardless of complexity, long lines make it hard to view side by side diffs on your screen.
- dudeman13 5y ago>Why not a 1000 character long line? I work in a codebase where a previous dude constantly did this. I do not find those lines amusing. Whenever I'm un-fucking his stuff one of the first things to do is expand his infinite lines into usually 5-50 lines because visualizing and reasoning about 50 lines of code crammed into one requires someone who is totally a way, way better programmer than me. I don't need to git blame to know when the code was written by that guy.
- compiler-guy 5y agoIn a personal project that makes a lot of sense (and in a personal project you have your choice), but once you are in a corporate or open source project of more than just a couple of people, code is read far more often than it is written, and by many more people than the original author. In those circumstances, it makes sense to optimize for readability to everyone rather than the author’s personal preferences. One can easily argue that Google’s style isn’t optimal, but it’s harder to argue that a personal preferences free for all is optimal.
- whatever1 5y agoThe fact is that the limit of 80 characters length is arbitrary. No evidence that code of 80 characters length is more readable than code of 83 characters length. The other fact is that few devs craft their code to fit 80 characters. Instead they write code and let formatters do their thing. But automated formaters are doing a horrible job, aka if I write a line that is 81 characters long, they will massacre it to a set of unreadable lines with no proper aligning. So now we are at the mercy of automated formatters that try to enforce an arbitrary constraint that is irrelevant with today's code editing/reviewing technologies.