ext_8103: (Default)

[identity profile] ewx.livejournal.com 2009-05-11 08:03 pm (UTC)(link)
Even at 4 space indents breaching 80 columns is often a hint to use a subroutine. (Indeed IIRC there are those who advocate using 8 space indents precisely because it forces you to break things up into subroutines.)
lnr: Halloween 2023 (Default)

[personal profile] lnr 2009-05-12 08:53 am (UTC)(link)
It's possibly true, and looking at a random example of a bit of my code I could actually fix most of the long lines simply by splitting them in two without much loss of readability, and I have used subroutines in some places so none of the long lines are caused by indenting off into oblivion.

I've got some rather horridly long regexps that I'm not sure I could make shorter though. (Although actually I can spot a way to lose about 8 characters off the worst instance, *ahem*, which would at least get me under 100 characters). Someone better at regexps than me might well be able to improve it though.

And some print statements where I'm printing a c. 80 character line of output and it seems daft to create a variable to put it in just to make the code narrower, when no-one who's going to be reading this code is likely to be doing it restricted to 80 cols, those are only about 90 cols.

My worst lines seem to be 123 cols, including a comment on the end of the line. And I think those are getting a bit too long. I shall do better in future.

Basically a 100 column emacs window is just a nice size though :)
ext_8103: (Default)

[identity profile] ewx.livejournal.com 2009-05-12 10:28 am (UTC)(link)
If you're using Perl then you have the option to break up regexps over multiple lines, insert non-semantic whitespace, comments, etc. See “/x modifier” in man/perldoc perlre. That said I don't use this myself (not that I write all that many monster regexps).