Re:Stop Writing Dead Programs (Transcript)
by bruce343434 on Wednesday October 19, 2022 @07:09AM
(#33260375)
How do you envision an interval around a limit? The fact is that you have to draw the line somewhere. If your interval is +-20, then setting a "limit" of 80 is really just a hard limit of 100.
Re:Stop Writing Dead Programs (Transcript)
by alpaca128 on Wednesday October 19, 2022 @03:28PM
(#33266808)
By letting the code formatter exceed the limit if it allows for more readable formatting in certain cases. Going for a 100% hard limit means sometimes it'll shuffle chunks of code around because of 1-2 characters and that just doesn't make a lot of sense.
Or in other words, by formatting the code more like a human than dumping the source tree with a blind set of rules. If Copilot is possible then so is an AI model able to consider how code actually looks on the screen.
Re:Stop Writing Dead Programs (Transcript)
by bruce343434 on Thursday October 20, 2022 @03:39AM
(#33271845)
How do you quantify the tipping point where a longer but continuous line is prettier than a broken line? (broken where?)
Re:Stop Writing Dead Programs (Transcript)
by atq2119 on Friday October 21, 2022 @03:01AM
(#33285310)
They already answered the question: you use statistical methods (aka AI).
Re:Stop Writing Dead Programs (Transcript)
by pizzaburek on Wednesday October 19, 2022 @10:12AM
(#33262482)
For my personal Python projects I set a hard limit in the 94-96 range. That's wide enough that I actualy adhere to it instead of just ignoring it.
PEP8's and Google style guide's limits of 79 and 80 are way to narrow for a language with 4 space identation. However PEP says that "it is okay to increase the line length limit up to 99 characters" while Google's 80 is just a soft limit that can be broken in certain cases like long URLs.
That said, I don’t think it should be a hard limit and it’s fine if a lines a bit over, +/- 10 like you said. Certainly not something that we should contort into multiple lines just to keep under a hard limit. Unfortunately, a few auto formatters only do hard limits - it’d be interesting to see how an acceptable interval around the limit would work.
Plus, I’ve noticed the limit makes more of a difference for comments than code so I try to keep comments under that. The written word appears more sensitive to line length.