[phobos] Column limits again

Robert Jacques sandford at jhu.edu
Sun Apr 10 01:15:26 PDT 2011


On Sat, 09 Apr 2011 19:02:30 -0400, Andrei Alexandrescu  
<andrei at erdani.com> wrote:

> I must bring this back into discussion because it seems the recent  
> traffic in the matter left the impression that "anything goes".
>
> We have a pull request  
> (https://github.com/D-Programming-Language/phobos/pull/27) with at least  
> one line that is 195 characters long and others of comparable lengths.
>
> I think as far as presenting arguments the ship has sailed. Let's now  
> agree on a maximum line length. What should that be? 80? (Yes please.)  
> 100? 120? Give me your vote for a number, but please let's avoid  
> reviewing telex rolls going forward.

I've recently found a certain elegance in the 80 character line  
(particularly with regard to posting code to bugzilla). That said, I've  
got code in my std.variant update that's currently sitting at an indent of  
52 characters (13 4 character 'tabs'), which makes a 80 lines limit look  
silly. (Then again: struct,function,switch,static if,foreach,static  
if,static if,case,foreach,static if,static if,if,static if; isn't common.  
Also, Once I refactor the code, this indent is going to go up by another  
static if block)

My take would be a soft limit at 80 and a hard limit at min(80+indent,  
some_upper_limit). Also, we should consider if short, inline comments and  
assert/enforce error messages should have a different soft limit than  
regular code. (i.e. recommend code in lines 1-80 with brief comments in  
80-100/120.)


More information about the phobos mailing list