Tabs vs spaces in code (was: Emacs auto-modes and tabs)
bscott at ntisys.com
bscott at ntisys.com
Thu Apr 17 09:18:56 EDT 2003
On 16 Apr 2003, at 7:09pm, kclark at cetaceannetworks.com wrote:
> (not to start a flamewar or anything, but you do know that inserting
> real tabs in certain files (i.e. source code files) is frowned upon
> (by some people) right?)
I know some people prefer spaces. Maybe I'm just old-fashioned, but I
prefer tabs. One reason for this is that inserting a tab is (should be) the
same everywhere. Even if I don't have a fancy editor that does
auto-indenting, a tab is still a tab, and I can insert one with a single
keystroke. Of course, now Emacs is screwing that up.
I've never particularly bought the argument that tabs are more prone to be
being mangled my broken software than spaces. I've seen it mangled both
ways pretty well. And, like I said, if something is corrupting your code
files, focusing on the issue of tabs-vs-spaces is ignoring the *real*
problem....
What *is* important is consistency. Maybe one wants to use tabs for
indentation. Maybe one wants to use spaces for indentation. No matter what
one prefers, one should do the same thing everywhere. Hence my frustration:
I've got all these source files full of tabs, and Emacs keeps trying to
insert spaces. And at a different indent level, to boot. Grrrr.
Keep in mind that I do not use tabs for *alignment* [1]. Just *code
indentation*. I consider TAB to be a kind of special character, with a
logical meaning of "nesting level plus one". This has the added benefit in
that I can, if so desired, temporarily adjust my tab stops to expand or
condense indentation levels in [2]. As long as I stick to a strict policy
of tabs-for-indentation, I don't have trouble.
This is, of course, for my own code. If I'm working for a company, or in
an organization or group, I follow whatever standards are in place.
Footnotes
---------
[1] Well, okay, I do, sometimes, in quick-and-dirty code. But never
in anything that might leave my $HOME/bin directory. :-)
[2] Granted, I rarely do this. But I have done it on occasion.
--
Ben Scott <bscott at ntisys.com>
| The opinions expressed in this message are those of the author and do |
| not represent the views or policy of any other person or organization. |
| All information is provided without warranty of any kind. |
More information about the gnhlug-discuss
mailing list