Tabs. It drives me nuts to see people use spaces for everything.
Tabs are there for exactly that purpose. If you want your code to line up properly, just comment on how wide your tabwidth is, and the reader of the code will adjust accordingly. Or indent in a tab-independent fashion.
I like my tabwidth set to 3 or 4. It makes code easier to read for myself. I can't stand it when I open a GNU project and it looks like someone threw up brackets all over my screen. This wouldn't happen if GNU didn't use an awkward mix of previously-assumed-8-spaces-wide tabs and spaces to indent their code.
I started this out of a spirited conversation between my boss and I. We've been using tabs for years; the argument being that anyone can adjust their tab width to whatever they prefer. As Daniel said, in theory this works but in reality it never allowed for circumstances where you'd need to indent something an odd (or if your tabwidth was odd, even) number of spaces. For example, check out Google's style guide for C++: http://google-styleguide.googlecode.com/svn/trunk/cppguide.x... You can't format those function arguments like that using tabs. This kind of granularity is essential, especially working in a team environment.
I used to be an all tabs guy(sw=4, ts=4). Then I got hooked on Python and it was easier to go with the spaces only. Have configured my .exrc so that tabs get mapped to spaces (4 / tabstop). I don't even think of it any more. All my old C sources have morphed into spaces only as a result. Hey, disks have become huge and text compression is pretty efficient so I don't lose sleep over it anymore.
I can't agree with you for one simple reason: I have never seen a file that exclusively uses tabs for indentation. There are always a few spaces accidentally thrown into the mix, and therefore, as you mentioned, the user has to know the tabwidth. Doesn't forcing the user to use your tabwidth defeat the whole purpose of using tabs?
Tabs...though in a way I don't think code files should have any whitespace in them; in my ideal world the disk file would be packed and the programmer's editor would use your preferred code beautification, just like syntax highlighting. Obviously that would be a hassle if you didn't use a contextual editor but I question the ongoing importance of that option.
I'd like to use tabs, unfortunately pythons 'significant whitespace' mess makes me have to use spaces instead. To make sure I stay clean I've configured things such that I can actually see the spaces.
Especially with cutting and pasting sample code this is a total pain.
The interesting part is that many samples in python tutorials have their spacing messed up so that the samples don't work the way they're intended.
Python is a great little language, but this really keeps tripping me up.
[+] [-] yan|16 years ago|reply
Tabs are there for exactly that purpose. If you want your code to line up properly, just comment on how wide your tabwidth is, and the reader of the code will adjust accordingly. Or indent in a tab-independent fashion.
I like my tabwidth set to 3 or 4. It makes code easier to read for myself. I can't stand it when I open a GNU project and it looks like someone threw up brackets all over my screen. This wouldn't happen if GNU didn't use an awkward mix of previously-assumed-8-spaces-wide tabs and spaces to indent their code.
[+] [-] els|16 years ago|reply
[+] [-] CyberFonic|16 years ago|reply
[+] [-] humbledrone|16 years ago|reply
[+] [-] DanielStraight|16 years ago|reply
[+] [-] anigbrowl|16 years ago|reply
[+] [-] unknown|16 years ago|reply
[deleted]
[+] [-] DanielStraight|16 years ago|reply
[+] [-] jacquesm|16 years ago|reply
Especially with cutting and pasting sample code this is a total pain.
The interesting part is that many samples in python tutorials have their spacing messed up so that the samples don't work the way they're intended.
Python is a great little language, but this really keeps tripping me up.
[+] [-] icey|16 years ago|reply
[+] [-] ErrantX|16 years ago|reply
anything else (php, c++, html, etc.) tabs
[+] [-] knv|16 years ago|reply
[+] [-] byoung2|16 years ago|reply