develooper Front page | perl.perl5.porters | Postings from February 2022

Pre-RFC: Change maximum line length rule to recommend 100 max, andenforce 120 characters max.

Thread Next
From:
demerphq
Date:
February 19, 2022 15:24
Subject:
Pre-RFC: Change maximum line length rule to recommend 100 max, andenforce 120 characters max.
Message ID:
CANgJU+UQoduWRyqebLadko=ZH8ZVyGS1K9Vn0=RXyf_OYVs+AA@mail.gmail.com
Perl core development has long recommended and/or required that we stick
the "traditional" line length of less than 80 characters. We have tests
which enforce this. This line length made sense in the early days when
terminals were text based and where this was the maximum they COULD
display. In the intervening time monitors have improved and nobody uses
text based screens anymore. Screens are much wider than they are high these
days, and can display far more lines of text than they used to. Even with a
large font on a laptop the maximum width is far closer to 130 than it is to
80.  On linux a decent terminal will have support for 132x43 for example.

Breaking long lines of code or text to meet this artificial limit causes
its own problems. Code has to artificially be broken into multiple lines
which makes it hard to grep for expressions, and the reformatting necessary
requires our volunteers to do extra work and potentially leads to bugs . It
is also problematic as some lines cannot be broken, for instance
diagnostics and other artifacts need to be on a single line for them to be
processed by our tooling. This means we can easily have code being forced
to be wrapped to one half the length of a line next to it. The rules are
also not applied consistently, generated code is not held to these rules
nor is any included code from cpan.

This RFC proposes we move to a recommended limit of 100 characters and a
hard limit of 120 characters. Meaning we should produce tooling which will
warn when code is longer than 100 characters, but only test for code that
is longer than 120 characters. I volunteer to do the required tooling
changes.

PRIOR ART:

The linux project has moved from an enforced maximum of 80 characters to a
'recommended' limit of 100. To quote Linus: "Excessive line breaks are BAD.
They cause real and every-day problems."

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bdc48fa11e46f867ea4d75fa59ee87a7f48be144
https://lkml.org/lkml/2020/5/29/1038

The Rust project has moved to a maximum of 100:
https://rustc-dev-guide.rust-lang.org/conventions.html#line-length

To contrast Python's PEP8 still recommends a 79 character limit.
---

Thanks to Michiel Beijen for some of the research quoted in this Pre-RFC.

Cheers,
yves




-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About