On Tuesday 10 February 2004 21:45 CET Daniel Quinlan wrote:
> Theo Van Dinter <[EMAIL PROTECTED]> writes:
> > I don't think we ever came up with an "official" set of standards.  In
> > general:
> >
> > - indents are 2 spaces
> > - use 'if (expr) {', although 'if ( expr ) {' is tolerated when I do
> > it. ;)
> >
> > uhh...  that's all I can remember.
>
> We generally (about 54-59% of our perl code) collapse each set of 8
> leading spaces into a tab.

Uh, no, please not. That's one thing I always "fix" when I see it (I never 
had the idea this might be intentional -- to me it was just some annoying 
behaviour of some editors, incuding vim). Either always use tabs or always 
use two spaces, but don't mix-and-match.

> Blank line after initial declarations of a sub.  Blank lines in rest of
> sub are optional.

You mean a newline before the curly brace? I think the rule of thumb is to 
do so for subs and big blocks, short blocks may have the curly on the same 
line.

> I agree about not using cuddled else, but I don't think we should start
> using spaces around if and while expressions.  I don't know when that
> started, but it's really annoying.

I think there must have been some BSD C coder a round who introduced that :) 
They use spaces after keywords but not after function calls. 

> Also note that 80 columns is our width.  It's okay to exceed that on
> rare occasions where it is necessary or looks much better, but it's
> generally better to go on to the next line.
>
> Bob Apthorpe <[EMAIL PROTECTED]> writes:
> > # perltidyrc
> >  -i=2    # use n columns per indentation level (default n=4)
>
> Yes, although I think 4 would be better.

Please not 4. Either two or tabs, everything else is a pain in the thumb to 
code with when you don't have a good editor around.

> >  -nt     # no tabs: use n spaces per indentation level (default)
>
> Not quite, see above.

See above :)

> >  -bt=2   # sets brace tightness,  n= (0 = loose, 1=default, 2 = tight)
>
> I think we use 1?

We use both, I think 1 is preferrable.

> >  -pt=2   # paren tightness (n=0, 1 or 2)
>
> definitely 2.
>
> >  -sbt=2  # square bracket tightness (n=0, 1, or 2)
>
> definitely 2.

All the three above should be the same, either 1 or 2, I'd prefer 1.

> >  -ce     # cuddled else; use this style: '} else {'
>
> Disagreement on this one.  I think Justin does this, but nobody else
> does.

ACK. I do it sometimes when I have an if-then-else with just a few lines in 
the blocks, but for large blocks hard to read.

> >  -bar    # opening brace always on right, even for long clauses
>
> I think -nbl is closer.

-sbl :)

Cheers,
Malte

-- 
[SGT] Simon G. Tatham: "How to Report Bugs Effectively"
      <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>
[ESR] Eric S. Raymond: "How To Ask Questions The Smart Way"
      <http://www.catb.org/~esr/faqs/smart-questions.html>

Reply via email to