83 points · by miles · 16y ago · 33 comments
Tabs aren't just used at the beginning of lines. There might be a left-aligned, multi-line comment to the right of a block of code(...)
I cannot fathom what point he thinks he's making with these. If you're using tabs in a way that depends on tab width, you're doing it wrong.
Tab indentation generally means that one tab character is one layer of indenting. That's it. It's about semantic structure, not layout.
If you want to make ASCII art, or align things like paragraph-style comments, or "indent" things that aren't part of a block of code like pieces of a lengthy conditional clause split over multiple lines, use spaces instead (and then the five people who use proportional fonts will complain that using spaces for alignment "isn't portable"). Of course, if you're using a language with an off-side rule for syntactic whitespace even a die-hard tabber ought to just use spaces.
Personally, I dislike that sort of non-semantic formatting business in source code (and I think off-side rules in syntax are a horrible idea), but that's a matter of taste. And obviously, consistency is vastly more important than the particulars of indenting style. But I get tired of people arguing against tabs on the basis of not knowing how to use them properly.
On the other hand, this unintentionally makes a different, very strong argument in favor of using spaces: people can't manage to use tabs properly, so don't let them. This is why we can't have nice things, folks!
Just have guidelines and stick to them. What sucks is inconsistency.
Everybody's got an opinion about code layout. It doesn't matter. There's no good or bad layout. Readability is just another word for "looking like stuff I'm used to read".
Now whenever I read python code that is outside of PEP8 just a little bit, it makes me cringe, but I can still read other, non python code indented almost any way. Thought that was interesting.
Sure you'd need to know the standard occasionally but can't the code just load with my "stylesheet" and then use tabs. Then when it's saved the code is simply reverted to space delimits. This sort of formatting issue should not be an issue anymore surely?
2. Sometimes I use tabs. Sometimes I don't. I can never really remember, because Vim is set to :expandtab for me on some of my machines. What I do know is that I never really care.
I use the ^T, ^D, <<, >>, and = commands to shift my left margin around in Vim. I haven't typed a space or a tab at the beginning of a line in years. After all, why use low-level functions when you have high-level ones?
Oh yeah, and I'd rather GOTO label than BREAK.
Nearly every editor I've used allows you to adjust tab size. In my mind, that means tabs allow every user to set the width that they prefer.
I comment like this. It's also not hard to do. You type something like:
some line of code ; here is my comment, blah blah blah, very long, blah blah blah
Then press M-q ("fill-paragraph"), and Emacs turns it into: some line of code ; here is my comment, blah blah
; blah, very long, blah blah blah
Sometimes this looks nicer than: ;; here is my comment, blah blah blah, very long,
;; blah blah blah
some line of code
Anyway, both styles are quite common."Or consider someone who is on an 80x25 terminal"... ok now where are just getting silly.
I always consider people on 80 column terminals, because although I have a huge monitor, I would like to display more than one file at a time. Aiming for 80 columns means that you appeal to the "lowest common denominator" and it means that you can have lots of files within easy visual reach. (I actually end up near 90 at home and 85 at work... but I try not to exceed 78 too often.)
Do you not people see these two twin (troll?) threads posted by the same person? Within the same minute?
http://news.ycombinator.com/item?id=1058196 http://news.ycombinator.com/item?id=1058195
Someone went out of his way to find two trivial, but hot-button issues and submitted an argument for each. It's another "experiment".
If I came across an opposing view, I would typically submit it in a comment/reply, not start a separate thread. And if you look at the topic IDs, they were submitted right after the other (i.e. submitter knew of both sides before hand.)
That, and the triviality of the subject made be suspicious of the submitter's intentions. I didn't mean to be hurtful, but, for crying out loud ..
there are certain evergreen topics here that are always going to lead to heated debate. iphone versus android versus pre, mac versus windows versus linux, rails versus drupal versus php, ruby versus python versus c++ versus perl versus lisp, etc etc etc.
each time an article is posted here that takes a stand one way or the other, it prejudices the resultant discussion. it's sort of inherently understood that, if you want to comment strongly anti-iphone, you better wait until the posted article itself is also anti-iphone, or else you're going to face stiff opposition and downvotes.
by posting two articles, one pro-tab and one anti-tab, the submitter has neatly sidestepped that problem. if news.yc tilted strongly one way or the other, you'd expect one article or the other to get most of the upvotes, and the other one would sink. as it turns out, both articles have been running neck-and-neck for hours. interesting. it shows that tab lovers and haters exist here in equal proportions, which i really wouldn't have guessed.
Additionally, tabs are 8 spaces to the python interpreter. If you're not using 8 space tab stop, you're setting up people who use your code for a world of hurt if they ever change anything in your files.
And the reason why spaces are bad is because it makes subtle errors when they get mixed in with tab-indented code. This is an argument for consistency, not for using spaces.