[Gllug] vi indenting

Tom Gilbert tom at linuxbrit.co.uk
Wed Dec 19 15:41:42 UTC 2001


* Alex Hudson (home at alexhudson.com) wrote:
> On Wed, 2001-12-19 at 09:48, tet at accucard.com wrote:
> > texts, then sure, indent with spaces, but I've yet to see a single
> > valid argument (including jwz's) for indenting code with anything
> > but tabs. 
> 
> I agree 100%. Anyone using anything to indent other than tabs should be
> shot. Space signifies separation, tabs signify layout. You can move
> tabs. Tabs are fantastic.

Shoot me, tabs suck :)

Of course, we can make stupid "xxx rules, yyy sucks" comments all day
and nobody wins, it should be clear that you can't be so cut and dry,
it's mostly personal preference and operating evironment.
 
> People who use two spaces _and_ don't cuddle braces are the worst kind
> and produce the most unreadable, messy code. That's not opinion, that's
> fact*, you write better code when you use tabs (i.e., ASCII#9, not the
> tab button to issues sequences of spaces).

I disagree with you on the tabs of course (AND I've seen your code ;-),
but I don't think the cuddle braces thing is as flat out as you put it.

Personally, it depends on the language I'm using. In C, I use this
style, because I find it fits the language better:

if (foo)
{
  /* do stuff */
  /* note indendations are by 2 spaces, haha! */
}
else
{
  foo();
  bar();
}

A lot of it's to do with the language, because in C, you can easily go
from :
else
{
  foo();
  bar();
}

to :
else
  foo();

So that "{" isn't really tied to the else (in my head).

But when I write perl, I bunch up:

if ($foo) {
  # do stuff
} else {
  # don't
}

This is deliberate - partly because the latter form is more common in
the perl world, but mainly it's for language reasons, because perl
won't let me leave off that brace, so to me it makes sense for it to be
on the same line.

Tom.
-- 
   .^.    .-------------------------------------------------------.
   /V\    | Tom Gilbert, London, England | http://linuxbrit.co.uk |
 /(   )\  | Open Source/UNIX consultant  | tom at linuxbrit.co.uk    |
  ^^-^^   `-------------------------------------------------------'

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list