Visual Studio 2010 Forces Tab Indenting
An anonymous reader writes "For years, Microsoft has allowed Visual Studio users to define arbitrary tab widths, often to the dismay of those viewing the resultant code in other editors. With VS 2010, it appears that they have taken the next step of forcing tab width to be the same as the indent size in code. Two-space tabs anyone?"
This tab thing makes Slashdot front page and the following didnt? Windows 7 way hotter than Vista off the line, now more popular than all OS X versions. Okay then...
How is this tab things news or interesting at all? Here is what Brittany Behrens a PM for the editor team said:
(bolding above mine for emphasis)
Gee, the team solicited comments, did some research and made a change that people wanted. Of course, any change will make somebody unhappy.
Brittany even volunteered to give folks a simple editor extension to make the settings different for those that want it. My assumption is that anyone using Visual Studio is a developer and capeable of using such an extension, or writing it themselves. It is not difficult.
-Foredecker
Jibe!
FIGHT!
They're a meta character, and the meaning can be changed later.
* If I'm hitting the tab key and it's inserting X spaces, and I hit the key once too many times, I have to hit delete X times instead of just once.
* If the code is reused in a new environment where everyone wants their indentation levels at 4 spaces instead of 2 or 3 or 8, you have to reformat a lot of code manually. If tabs are used, remap the sizing of the tab character and you're done.
* The tab character itself has some semantic meaning - indent. The space is a word and symbol separator. Use an indentation character when you want to indicate indentation.
creation science book
I find the use of spaces irritating and stupid, to be equally blunt. I mean, the tab is a character that exists _specifically_ for aligning text. It behaves predictably across editors and allows easy changing of width for various programmers. You never have to worry about half indents choking the editor. Why replace tabs with spaces? So you can hit the space bar a thousand times whenever you need to edit something outside a programming editor? So you can't change indent size without some obscene editor voodoo that may change the spaces and corrupt your diff history? But I doubt I'll ever understand... Most of the "benefits" I see people listing for using spaces I consider either more true for tabs, or disadvantages.
The biggest benefit to tabs (especially if you code in a corporate environment) is that people can view the code based on *their* preferred indentation / spacing e,.g. I may like my tabs to be 2 spaces, another developer may prefer 3 or 4 spaces.
By setting up their IDE / editor to their preferred tab width, the code indents to the way they like it.
By forcing all your tabs to be spaces, anyone else viewing the code will be forced to view / edit it in your indentation.
I don't have to backspace many times when I remove nested loops and they always line up properly (a personal thing that drives me nuts when two lines in the same scope don't line up) and it only needs one tap of a button to make it done. Hitting the space bar isn't a bad thing but it just feels inefficient when you have to repeat it so many times also most editors will allow you to highlight code blocks and use tab or shift-tab to increase/decrease white space which I'm not sure if they will do the same for you for spaces.
A loop, by its nature, continues. If that didn't make sense, start reading this sentence again.
Ending sentence fragments with anyone, anyone? Does anyone like this convention, anyone? Can we just see it die horribly in flames, anyone?
Comment of the year
So, for all those tab fans, what is it about tabs that you find useful?
So there you go. In addition to just being more manageable and flexible, using tabs over spaces will help ensure the future existence of the human species on this planet.
Okay, so while the last point was in jest (mostly ;), I stand by the first four. Honestly, I've yet to see any pro-spaces people give any substantial reasons (when applied to modern computers and development tools) that spaces work better than tabs.
So, for all those space fans, what is it about spaces that you find useful?
"What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
/)
Herb Sutter once observed in relation to C++0x that when it comes to complex, interesting questions of language design, very few people are even vaguely qualified to comment, and when it comes to issues of whitespace every idiot on the planet has an opinion. And when those idiots get the chance, they'll post those issues as news on an aggregator of some sort (ok, that last part wasn't Herb Sutter).
import psychic
You can then retrieve the exact number of tabs the last editor to that block/line of code had in mind when they wrote it. This does add a bit of overhead, mind you, such as needing a pint of goat's blood every time you run the program.
I find the use of spaces irritating and stupid, to be equally blunt. I mean, the tab is a character that exists _specifically_ for aligning text. It behaves predictably across editors [...]
Not in my experience it doesn't!
You never have to worry about half indents choking the editor.
I don't understand what you mean by this.
Why replace tabs with spaces? So you can hit the space bar a thousand times whenever you need to edit something outside a programming editor?
Ironically, one of the reasons I prefer to use spaces is so that the code is readable when I do want to edit (or view) something outside of the programming editor. Code with tabs in it is usually completely messed up.
Ah, well, it'd be a funny old world if we were all the same!
I know it's bad form to reply to yourself, but really Slashdot? THAT is how you render an HTML ordered list? What blind, drunk monkey on an acid trip designed that stylesheet?
Of course the icing on the cake is that in the preview it was properly rendered as an ordered numeric list. WTF, Taco?
Oh, look at the name of the CSS files responsible: idlecore-tidied.css. Makes sense now I suppose. Anything to do with idle.slashdot is already horribly broken.
"What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
/)
Don't get me started on makefiles. An syntactically significant invisible character? Dumbest idea ever.
You mean you can't see the brilliance of a preview mode that doesn't match what the real thing will look like? ;)
Attention zealots and haters: 00100 00100
I'm doubtful that giving an invisible character semantic meaning is wise
(In the voice of dr. Farnsworth) Yes, yes. Let's all forget about those nasty invisible characters like \r \n and especially \0
You don't know what you don't know.
* The tab character itself has some semantic meaning - indent. The space is a word and symbol separator. Use an indentation character when you want to indicate indentation.
No, it doesn't mean "indent". It means "tabulate". You shouldn't be using tab to indicate indentation. You should use tab align table columns -- i.e., to indicate tabulation.
After all, I am strangely colored.
And if you prefer to look at 2 or 4 spaces per tab, you're hosed. Tabs-only is best. Then each person can set the level of indent they want to see. As long as you don't mix spaces and tabs, you're fine.
Comment removed based on user account deletion
I think you may be verging on the insane.
I know this is Slashdot an' all but really? You've got to the point where you have to bitch about tabs settings in MS's development environment. Have MS not been squishing enough small companies or something equally evvvvvvil for you lately? Quick everyone, another example of MS being a horrible overlord, they've combined tabs and indent in Visual Studio!
*sigh*
I think the issue is more that tab and space are visually indistinguishable.
A good guideline is that you should be able to glean all the semantically meaningful data from the source code even on a hard-copy. I can certainly see a newline in hard-copy (although I can't tell whether it's \n, \r\n, \r or whatever). Similarly, I can see tabs in hard-copy, but I can't tell them apart from spaces, so in that sense it's wrong for them to be any more semantically meaningful.
Dude, the editor takes care of that for you. Why micromanage spaces and alignment when that's what computers are good for? There's a reason things like ReSharper exist. I never ever use tabs (option is set to insert spaces instead), and I've never had to deal with any of these issues the "tabs not spaces" crowed insist exist if you use spaces.
So, what you're saying is, as long as you're using the right editor, it'll take care of these things for you, it's only a problem for people who pull it up in a different editor that doesn't do the same micromanagement yours does. I point this out not because you're in any way wrong, but for some reason fans of using spaces instead of tabs often complain that the way different editors deal with tabs is a problem, while acting as if this isn't a problem in the other direction. Personally, I find the behavior of tabs across editors to be far more consistent than the way spaces are treated, because some editors do exactly as your does (and should), but more do not, or they do some random subset of all the nice things they ought to do, like making a single delete drop a whole indent level, or just a space, or how the arrow moves through them, e.g go one space? one indent level? go directly to the first non-space? Will it even let me arrow back beyond the first non-space character? Sometimes yes, sometimes no, sometimes a space at a time, sometimes an indent level at a time, etc. There's no good argument to be made in favor of either spaces or tabs in which one cites inconsistent editor behavior, it cuts both ways, but space-indenters always seem to cite these inconsistencies as if it somehow only affects tabs and not spaces.
"Convictions are more dangerous enemies of truth than lies."
And then comes another guy who uses three spaces to indent and your code is gone. Allowing each user to change arbitrarily the width of the TAB is a BAD idea.
The original use of the TAB key was to ease the creation of tables in typewriters. There was a set of mechanical stops, one for each column, and you could set or reset each stop. Pressing the TAB key moved the carriage to the next stop. Some electronic terminals, like the VT-100 for instance, kept this convention, allowing one to set or reset the TAB stop for each column. In modern computers this is not really necessary, since editing tables is often done in spreadsheets.
Setting the TAB width arbitrarily at fixed multiples of eight or any other number of columns really doesn't help much, since the indentation support of modern editors is much more powerful than that.
The only use of the TAB key for me is moving to the next widget in the GUI.
But you wouldn't use tabs for that. You would use tabs to indent to the current level, and then spaces for formatting. In the example you showed where everything is at the top level, there would be no tabs at all.
If you use more spaces for an indent level, even a dead, beaten horse could easily identify the nesting level.