OT: tabs and spaces

From: Lasse KÃrkkÃinen / Tronic
Date: Sat Jul 17 2004 - 16:31:59 EST


When you write prettyprinters, programmers' editors or anything that does some kind of code indentation, please take care of the following rules:

1. NEVER convert N spaces into one tab; they are not equal with any N
2. count spaces and tabs separately (one tab for each { }, etc)
3. if aligning with anything (text, not indent), use spaces only
4. print tab chars at the very beginning of the line, never after any other characters

GNU indent and all other prettyprinters I know of violate the first three rules. I chose to write LKML because so many people writing indenting software, or just writing code, will be reading this now...

If the indentation is done this way, it never breaks with any tab width. The only (minor) issue concerns cutting long lines, because you cannot know the line length if you don't know tab length.

Before the flamewar begins: I am not saying that tab indentation or space indentation is better, just saying that the regular tab indentation is not optimal. So far I haven't seen anyone thinking that the regular way is better than this one, so there doesn't seem to be any debate about that.

If you agree with the above, please spread the message :)

As this is clearly off-topic, it may be better to answer to me only, not to the list.

- Tronic -

Attachment: signature.asc
Description: OpenPGP digital signature