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.