Words by c.z.robertson

Tabs vs. Spaces

2000-09-24 02:00:00 UTC

I was then inspired to take a look at Jamie Zawinski's website, and in particular at his opinions of tabs and spaces in programming. I'd actually read the document a few months ago. I didn't agree with it then and I don't agree with it now.

His approach is to separate the religious from the technical. He makes no attempt to judge what the correct tab-width should be, nor does he tackle any of the more complex formatting rules. He solves the problem of differing interpretations of tabs by simply eliminating them from files and requiring that all programmers respect the indenting characteristics of any file they edit.

While this does solve the problem, I would argue that it does so in a non-optimal way. The advantage of the tab character is that it specifies an indent but doesn't specify the size of that indent. It is a logical rather than presentational character. It is therefore possible for shared code to use each programmer's own preferred indent size.

So according to my preferred scheme, all indents that result from opening a new block should be marked with a single tab character, while lining up, say, the equals symbol in a set of assignments should be done using spaces (because the tab character has no standard size). Mixing tabs and spaces to achieve the same effect is pure evil, the worst of all possible worlds.

Agreed, but...

Craig Falls

2003-05-04 21:48:03 UTC

I agree completely. Here is a snippet from my .emacs:

(setq-default indent-tabs-mode t) (setq-default standard-indent 2) (setq-default tab-width 2)

Unfortunately, some modes do things like lining up = signs for me, and they do it with tabs instead of spaces. Take for example...

(setq gc-cons-threshold 3000000 max-lisp-eval-depth 3000 max-specpdl-size 1000)

The indentation for those second two lines is done for me, but with tabs. Is there any way to fix this behavior, without losing the tabs that *should* be tabs?

Craig

Eric Rizzo

2004-02-24 22:03:47 GMT/BST

I agree wholeheartedly. Yo can read my attempt at a logical explanation for my position at http://rizzoweb.com/java/tabs-vs-spaces.html

josh

2005-01-05 23:31:08 GMT/BST

My page mentions all of the issues: tabs vs. spaces