4 Jan 2006 rmathew   » (Master)

Confessions of a TAB-hater
I do not like it when people put TAB characters in their source code for indentation. I prefer to use spaces instead of TAB characters to indent my source code. Jamie Zawinski has written a nice document that clearly explains the problem. Note that I am not against using the Tab key as a quick way of indenting, but putting in actual TAB characters (ASCII character #9) in the source code. Different people set tabstops differently, so what looks good to them looks terrible to others. These characters also mess up the indentation in patch diffs.

VIM has an unfortunate optimisation that replaces consecutive spaces with as many TAB characters as possible and if you "set expandtab", then even desirable TAB characters (in Makefiles for example) are replaced by spaces. Yes, I know of using the Ctrl-V + Tab sequence to insert an actual TAB character in this mode, but it is painful. So I have ended up putting the following in my ".vimrc":

set shiftwidth=2
set tabstop=8
inoremap <Tab> <C-V><Tab>
autocmd BufNewFile,BufRead *.java setlocal expandtab
autocmd BufNewFile,BufRead *.c setlocal expandtab
autocmd BufNewFile,BufRead *.cc setlocal expandtab
autocmd BufNewFile,BufRead *.cpp setlocal expandtab
autocmd BufNewFile,BufRead *.h setlocal expandtab
autocmd BufNewFile,BufRead *.hh setlocal expandtab
autocmd BufNewFile,BufRead *.hpp setlocal expandtab
autocmd BufNewFile,BufRead *.xml setlocal expandtab
autocmd BufNewFile,BufRead *.sql setlocal expandtab
If I were to design a programming language, I would seriously consider not allowing TAB characters to be counted as whitespace. It would make source code use up a few extra bytes compared to what it would if consecutive spaces are replaced by as many TAB characters as possible, but I would trade that off for overall sanity.

By the way, I consider it really silly that the authors of make chose to make TAB characters so important, when they are virtually indistuingishable from spaces when you inspect Makefiles. Their mistake has cost the software world the creation of the monstrosity named Ant.

The Etymology of "Foo"
RFC 3092 is devoted to explaining how "foobar" came to be used so much in software code and documentation.

"A Practical Sanskrit Introductory"
Thanks to Anirban Mukherjee, I came across a nice document (2.5MB PDF) written by Charles Wikner containing introductory lessons for the Sanskrit language. Just take a look at the first chapter to see why I personally consider the phonetically precise Devanagari script to be far superior than the utterly challenged and much abused Roman script, even at the risk of appearing jingoistic.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!