(Was: On 80 columns should (not) be enough for everyone)
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jan 30 17:46:15 PST 2011
On Sunday 30 January 2011 10:55:53 Tomek Sowiński wrote:
> Andrej Mitrovic napisał:
> > If you really want to set up a column limit that *everyone* has to abide
> > to, then make a poll to see what everyone can agree on.
>
> Actually that's a splendid idea. Let's take it easy. Regardless of that
> silly beef I'm really curious what distribution will emerge.
>
> What is your preferred *maximum* length for a line of D code? (please reply
> with a number only)
My _preferred_ limit would be no limit but that if your line is getting to be
around 100 - 120 characters, then you should really look at breaking it up. If I
had to have a hard limit, I'd then pick 120 so that it would be rare that I'd
have to worry about it, and if I had to compromise a bit because others thought
that that was too long, then I'd pick 100. Particularly when you get much
indentation going on and _especially_ when you have descriptive names, it's
pretty easy to hit 80 characters, and it definitely feels overly limiting.
Personally, I find that it harms code formatting readability to consistently be
forced to break up lines due to an 80 character limit. It's especially bad when
you treat it as an absolute, hard limit, and things like the semicolon at the
end of the line make it so that you hit 81 characters and have to break up the
line.
So, if I have any say on the matter, I'd say 100 - 120 characters max if we're
putting a limit on it. I do feel very strongly about coding style, because I
hate having to twist how I write code to fit another style (though fortunately,
my natural style is at least close to how Phobos generally is). However, it is
normal to have to adjust your coding style on some level when working in a
group. I don't want to make a big stink about it either. 80 characters per line
_is_ one of the worst conventions out there IHMO, but if that's what we go with,
then I'll do it.
I suspect that the major reason that many of my lines tend to go over 80
characters is that I almost always pick very descriptive variable and function
names, and that makes lines longer. It could be that if a programmer who favored
short variable names were to write the same code that I typically do, then
they'd almost always stay within 80 characters.
In any case, I vote 100 - 120 characters for the limit, and I'd _really_ like to
not be restricted to 80 characters, but if that's what I have to do, then that's
what I have to do.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list