Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
Eight character tabs
Posted Oct 30, 2012 17:26 UTC (Tue) by nix (subscriber, #2304)
Posted Oct 30, 2012 21:49 UTC (Tue) by man_ls (subscriber, #15091)
Also, it takes longer to press space four times (or eight) than tab once. You can usually configure your favorite editor to insert the spaces when tab is pressed, even to delete them (:set expandtab in vim), so this issue is not so important.
As to the failure case you mention above, it makes sense to indent always using tabs, consistently. I have now remembered my painful days of aligning arguments using spaces -- it is just not worth it. I prefer to use short argument lists and set line wrap at 120 so I don't ever see multi-line argument lists; if they arise then just indent into a new line.
Posted Oct 31, 2012 0:42 UTC (Wed) by nix (subscriber, #2304)
I have never worked on a codebase where changing indentation via tab width changes did anything but turn the codebase into goo. It is hopeless.
The way to reindent is via automatic reindentation programs (such as GNU indent). Teach that your indentation style, and you're home free. Nothing else works.
Posted Oct 31, 2012 1:05 UTC (Wed) by bronson (subscriber, #4806)
I'm at the point where I'm ready to declare that, on a real world codebase with multiple teammembers, nothing at all works. Nobody likes the whitespace gestapo.
Posted Oct 31, 2012 8:52 UTC (Wed) by man_ls (subscriber, #15091)
My point of view is a bit different: tabs are good, therefore avoid everything that doesn't work with tabs. Lining things up is evil, hard wrap-up limits are evil, and so on. Yes, it requires a lot of discipline, but then so does software development in general.
Posted Oct 31, 2012 13:17 UTC (Wed) by nix (subscriber, #2304)
Posted Oct 31, 2012 11:40 UTC (Wed) by etienne (subscriber, #25256)
Well, have you ever used an editor with variable width font?
Why - maybe because text is easier to read...
Then, you can only use tabs to align stuff - unless that is the beginning of the line. If you comment a line using "//" at its beginning stuff stay aligned.
I do not want a hard limit on the number of chars, because not all chars are the same width...
Also, in some case (long debug printf() line), breaking the long line makes the structure of the function more complex than it really is; just tell you editor not to wrap and just ignore the end of the printf() line - it is just a printf()!
Posted Oct 31, 2012 13:21 UTC (Wed) by nix (subscriber, #2304)
Posted Oct 31, 2012 17:08 UTC (Wed) by tialaramex (subscriber, #21167)
No, thanks all the same but I'd rather actually see the code I'm maintaining and not trust that the bits I can't see aren't important.
I like the ASCII control characters, but most of them don't belong in my source code and that includes U+0009 TAB. Use soft tabs, set the continuous integration software to barf on hard tabs in source code, along with mysterious trailing whitespace and similar sins.
Posted Oct 31, 2012 18:52 UTC (Wed) by nix (subscriber, #2304)
Posted Nov 1, 2012 9:41 UTC (Thu) by ncm (subscriber, #165)
Posted Nov 1, 2012 12:06 UTC (Thu) by etienne (subscriber, #25256)
Posted Oct 30, 2012 18:11 UTC (Tue) by marcH (subscriber, #57642)
Tab indentation was invented to illustrate "The perfect is the enemy of the good".
Let everyone have his own indentation taste from the same source? Great idea on paper. Falls apart on a regular basis. Because it's not compatible with lining up across lines, because it's not compatible with a max width, etc. And because people are only human and will not be disciplined enough.
Posted Oct 31, 2012 11:37 UTC (Wed) by Jonno (subscriber, #49613)
Posted Oct 31, 2012 18:09 UTC (Wed) by marcH (subscriber, #57642)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds