Re: Coding standards / spaces vs tabs

2010-10-21 Thread Patrick Goetz

On 10/20/2010 9:05 PM, Bron Gondwana wrote:


P.S. Here's what I use in vim to make life worth living.
It makes tabs visible, and lets me indent blocks quickly
by 4 characters while creating the correct tabs.



If everyone uses vim, then this problem is easily resolved: :)

 set tabstop=3
 set expandtab


--
Patrick Goetz


Re: Coding standards / spaces vs tabs

2010-10-21 Thread Jeroen van Meeuwen (Kolab Systems)
Bron Gondwana wrote:
 This is the kind of thing that we really need coding
 standards for.  The prevailing spacing standard for
 the cyrus codebase is:
 

Yup we do, I had looked for the doc. you mentioned Greg had made but I 
couldn't find it. Sorry to have jumped the gun on this!

 Now I happen to think this is approximately one of the
 shittiest coding standards ever - but unless we all
 agree to change it, rewriting functions to use different
 indentation styles is counterproductive.
 

Can I motion we change it up? Whether it be 4 spaces to a tab or 4 tabs to a 
space, I don't care, but I love it to be consistent across all files and 
definitely on one single line.

 So please don't.
 

I won't do it again that's for sure.

 P.S. Here's what I use in vim to make life worth living.
 It makes tabs visible, and lets me indent blocks quickly
 by 4 characters while creating the correct tabs.
 
 set tabstop=8
 set softtabstop=4
 set shiftwidth=4
 set listchars=tab:-
 set list!

I think whatever coding standard we come up with can be in these little vim 
footers you see every once in a while, right?

FWIW, I would then also like to :argdo normal gg=G over all files to correct 
the indentation best vim can.

FWIW^2, I would then also like to remove all trailing spaces sed -r -i -e 
's/\s*$//g' `find * -type f` style.

FWIW^3, I would then also like to remove all CVS Id/Exp headers sed -r -i -e 
'/.*Id.*Exp.*\$\s*$/d' `find * -type f` style

Regardless, any of such changes will have to freeze up development for just a 
moment, since rebasing / merging any pending changes will most likely not 
succeed after these changes have been pushed.

Kind regards,

-- 
Jeroen van Meeuwen
Senior Engineer, Kolab Systems AG

e: vanmeeu...@kolabsys.com
t: +316 42 801 403
w: http://www.kolabsys.com

pgp: 9342 BF08


Re: Coding standards / spaces vs tabs

2010-10-21 Thread Bron Gondwana
On Thu, Oct 21, 2010 at 01:56:03AM -0500, Patrick Goetz wrote:
 On 10/20/2010 9:05 PM, Bron Gondwana wrote:
 
 P.S. Here's what I use in vim to make life worth living.
 It makes tabs visible, and lets me indent blocks quickly
 by 4 characters while creating the correct tabs.
 
 
 If everyone uses vim, then this problem is easily resolved: :)
 
  set tabstop=3
  set expandtab

3?  Why three?

Bron.


Re: Coding standards / spaces vs tabs

2010-10-21 Thread Patrick Goetz

On 10/21/2010 7:10 AM, Bron Gondwana wrote:

  set tabstop=3
  set expandtab


3?  Why three?



Einstein said make everything as simple as possible, but not too 
simple.  I think a similar principle applies to indentation:  indent as 
little as possible, but not too little.


When I first started coding again 10 years ago because both the 
programmers I was working with abruptly quit for personal reasons, 
leaving me (and the client) in the lurch, I inherited a bunch of code 
where tab was used exclusively to indent.  In my opinion, tab = 8 
characters indentation is ridiculously unreadable. With just 3 or 4 
nested blocks your lines start halfway across the page, increasing line 
breaks.  When I discovered tabstop and expandtab in vim, I realized that 
I could make the indentation anything I damn well pleased and it would 
automatically be invoked in any file I edited. And since I was the only 
one working on the code at this point, my opinion was the only one that 
mattered.  After playing around a bit, glancing at a bunch of code to 
make sure nested blocks jumped out visually, etc., I determined that 
-- at least for me -- 3 spaces was the optimal number; 2 wasn't enough, 
4 excessive.


Re: using 8 space tabs.  This is the point where someone says what are 
you talking about? Everyone has 24 1900x1200 monitors these days; you 
can have a terminal which is 300 characters wide!  Yes, and I can also 
go blind staring at it 8 hours a day -- I'll pass.


Re: using tabs for indentation at all:  especially given the somewhat 
disturbing growing ubiquity of python, getting in the habit of using 
tabs for indentation is like giving a box of matches and a stick of 
dynamite to your pet monkey.  It seems innocuous enough, but sooner or 
later a tragedy will occur.  Mixing tabs and spaces;especially given 
that the width of tabs is user-definable?  Add to the preceding showing 
the monkey how to light the matches and throw in a couple of liters of 
gasoline.  And yes, I'm aware that Makefiles require tabs; this is just 
one more indication that make is obsolete and needs to be rewritten from 
scratch using modern programming paradigms.


I know talking about indentation is like starting a vi vs. emacs -- 
which is better? discussion, but you asked.



--
Patrick Goetz


Coding standards / spaces vs tabs

2010-10-20 Thread Bron Gondwana
commit 6a9be341d3de4cff9f548bfb0c26546f1a4b2605
Author: Jeroen van Meeuwen (Kolab Systems) vanmeeu...@kolabsys.com
Date:   Wed Oct 20 13:21:00 2010 +0100

Make sure that sieve scripts use \r\n before saving them, so that multiline 
responses with different 

Also, remove the mixed use of tabs and spaces (I used 4 spaces to a tab) 
and indent accordingly for t

Fixes bug #3054.


--

This is the kind of thing that we really need coding
standards for.  The prevailing spacing standard for
the cyrus codebase is:

one indent == 4 spaces
leading sets of 8 spaces == 1 tab

So the indent looks like

[4 spaces]
[1 tab]
[1 tab][4 spaces]
[2 tabs]
...


Now I happen to think this is approximately one of the
shittiest coding standards ever - but unless we all
agree to change it, rewriting functions to use different
indentation styles is counterproductive.

So please don't.

Thanks,

Bron.

P.S. Here's what I use in vim to make life worth living.
It makes tabs visible, and lets me indent blocks quickly
by 4 characters while creating the correct tabs.

set tabstop=8
set softtabstop=4
set shiftwidth=4
set listchars=tab:-
set list!