[Tutor] Re: tabs or spaces (the endless debate!)

Derrick 'dman' Hudson dman@dman.ddts.net
Sat Feb 15 16:34:02 2003


--xXmbgvnjoT4axfJE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Feb 15, 2003 at 03:05:17PM -0500, R. Alan Monroe wrote:
| > hard tabs cause needless headaches for people who don't
| > use exactly the same tools that you use.
|=20
| I will take your word for it, but why is this the case? In my mind, a
| tab character is a fixed, known ascii character around the world.
| Everyone knows what it is,

This much is true.

| and if you indent with one, you KNOW that
| line is to be indented once. With two, you know definitively that line
| is to be indented twice, etc.

Well, sorta.  Suppose you set up your editor so that a tab is 5
spaces, but your indentation level is 7 characters.  For the first
indentation your editor will insert 1 tab and 2 spaces.  For the
second, 2 tabs and 4 spaces.  Now suppose I set my editor to the same
7-character indentation level, however tabs are 8 characters wide.
In that differing environment, mixing of the tabs and spaces is a real
problem (even in C code, where it makes it extremely difficult for the
programmer to follow the code).

| With spaces, they may be damaged during transport from mail program
| to mail program,

That's a misconfiguration of your mail program, then.  My mail program
won't mangle any spaces or other characters.

| and nobody sets their editor for the same number of spaces.

This is a configuration issue regardless of what character(s) you use.
Everyone on a given project needs to use the same indentation (and
line wrapping) style.

| The tab just seems more explicit and safer.

If you use only tabs and never mix spaces with them, then it is
functional but still causes some discomfort or havoc for different
environments.  You mention that vim (and other tools) can scroll long
lines.  That's true, but it doesn't help me read the code if it
doesn't fit on the screen.

-D

--=20
Dishonest money dwindles away,
but he who gathers money little by little makes it grow.
        Proverbs 13:11
=20
http://dman.ddts.net/~dman/

--xXmbgvnjoT4axfJE
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj5OsiQACgkQO8l8XBKTpRTBUACgg6QsyW+ELOzzGxXcka3nmN9k
3loAoKiiUa6yq6648XyC1xeNIFdy6P3r
=er7w
-----END PGP SIGNATURE-----

--xXmbgvnjoT4axfJE--