Visual Studio 2010 Forces Tab Indenting 390
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 is news at any level how? (Score:5, Insightful)
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 [engadget.com]. 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
Re:This is news at any level how? (Score:4, Insightful)
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
Of course id did; it's a developer tool so it immediately has street cred at /. ;->
Everything else that has nothing to do with coding or Linux is immediately a 3rd rate info byte unworthy of these hallowed pages
Re:This is news at any level how? (Score:5, Insightful)
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
It's kdawson's shift. He'll never post any article that's even mildly favorable of anything Microsoft related. However, if you can find a story that says some kid in Sweden doesn't like the Windows 7 box-colors, you've got yourself a kdawson front-pager! :)
Re:This is news at any level how? (Score:5, Insightful)
Re:This is news at any level how? (Score:4, Insightful)
No.
They solicited input from each other and in a blog post that generated a handful of responses. They did this to eliminate "a class of bugs" in the new editor that was triggered by setting the two numbers to different values. Which means they had a bunch of bugs (probably due to confusion between the two settings in the code) and someone had the brilliant idea that the bugs will go away if they just crippled the editor in such a way that the bugs will never be triggered. They solicited input, very quietly, and did it. This also means that the workaround they offer (writing a fucking extension, for fucking crying out loud - what is this, emacs?) will trigger all those bugs because they didn't fix them.
Idiots.
hard tabs are environmentally friendly. (Score:3, Interesting)
One true tab.
It's not like we don't have large enough monitors to accommodate it.
BTW - I wrote a script to change all the spaces used to indent php code for a popular cms to tabs
s/ {2,8}/\t/g; # replace anything from 2 to 8 spaces with a tab
Also joined long lines that had ridiculous double-indent for the second, 3rd, 4th, 20th lines,
Added a few other optimizations, like removing the stupid "xml-like" closing of entities in html files.
End result - shrunk it from 21 megs to 2.
WTF is wrong with
Foredecker is learning... (Score:2, Interesting)
Nice. I'm sure you'ld prefer to have something closer to the Windows core than this, but nice first post. If you're going to advocate it pays to have front billing.
Now if you're going to drive off course from source code formatting to operating system adoption I can be forgiven for also going wide afield.
How's that Window Mobile thing working out for you? Have they canned Roz Ho yet for the Danger debacle? Will she have to extrapeneur to a startup and bring back its corpse to prove her loyalty, or wil
Re:Foredecker is learning... (Score:4, Insightful)
Re:This is news at any level how? (Score:4, Informative)
Did you read the blog post [msdn.com] where they solicited feedback? It had 9 comments in total. Among them was this comment from the author of the blog (4th comment):
So they solicited comments on a blog that no one reads and immediately say they aren't planning to change anything when questioned. After saying they wouldn't be changing the option, no one complained. Wow, what due diligence.
Windows 7 still sucks but just not as much. (Score:2)
Re:This is news at any level how? (Score:5, Informative)
This tab thing makes Slashdot front page and the following didn't?
Of course the tab thing made Slashdot front page. Some people here virtually LIVE in Visual Studio, and code indentation is a heavily entrenched basic function of coding that people get surprisingly fired up about. Even if this particular aspect of code indentation isn't going to effect people, it's just begging for a heated emacs level discussion.
Your article, on the other hand, basically confirms that people like Windows 7 more than Vista, and that Windows 7 continues the well known and understood tradition of Windows outselling OSX by a factor of 10 to 1. These are things we already knew. Also, the article you site isn't even the source of the information, but refers to a much better Ars Technica article, which itself gets the data from Net Applications. I wonder if you didn't link the Ars Technica [arstechnica.com] article directly because it claims that "Linux was the only operating system [in December] to show positive percentage growth in market share." Or maybe this one "When putting this into perspective across the whole year, though, we see that Windows was actually sliding steadily throughout 2009 (93.66 percent in January 2009), while both Mac OS (4.71 percent in January 2009) and Linux (0.90 percent in January 2009) have been gaining." Or maybe the fact that Windows XP continues to hold onto 2/3rds of the active Windows installbase.
Also, it might be nice to point out that you're work at Microsoft in the Windows org as a development manger. It would boost your credibility as a poster, and reduce potential conflicts of interest.
Re:This is news at any level how? (Score:4, Informative)
0.90 to 1.02 isn't particularly impressive. 0.00 to 5.71 is.
It's not all that impressive if you've already enlisted every single PC OEM as your personal towel boy.
Re: (Score:3, Insightful)
Visual Python (Score:2)
Visual Python anyone? Doesn't Python force tabbed spacing for scoping?
Anyone, anyone? (Score:5, Funny)
Ending sentence fragments with anyone, anyone? Does anyone like this convention, anyone? Can we just see it die horribly in flames, anyone?
Re: (Score:2)
Visual Python anyone? Doesn't Python force tabbed spacing for scoping?
1) You must mean IronPython.
2) There's no Visual Studio integration for the current (2.x) version of IronPython. There used to be one for 1.x, but it had the status of a "sample VS language extension".
3) Python requires indentation, but doesn't require tabs (though it supports them).
4) Because the consequences of mixing tabs and spaces are much more nasty in Python, tabs are generally considered anathema among people who write in it.
Re: (Score:2)
Python always considers tabs to be 8 spaces regardless of what your editor is set to.
Well its not psychic, isn't it?
Re:Visual Python (Score:5, Funny)
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.
Re: (Score:2)
Oh right, python. [xkcd.com]
Re: (Score:3, Informative)
vim already does exactly this. http://vim.wikia.com/wiki/Modeline_magic [wikia.com]
it looks like this. (ts = tabstop, sw=shiftwidth) // vim: noai:ts=4:sw=4 /* vim: noai:ts=4:sw=4 /* vim: set noai ts=4 sw=4: */ /* vim: set fdm=expr fde=getline(v\:lnum)=~'{'?'>1'\:'1': */
-or-
*/
-or-
-or-
so using your example: /* MS_VC_INTENT=2; MS_VC_TAB=4 */
if you put on top of your file, // vim: set tabstop=4 shiftwidth=2
then vim will do the correct thing.
Re: (Score:2)
Yeah, but it doesn't matter what the indent is as long as your consistent. Python 3 won't let you mix tabs and spaces so you won't run into issues. You will still run into issues with Python 2 (which I believe IronPython is still using) since Python always considers tabs to be 8 spaces regardless of what your editor is set to.
Just as well too! You wouldn't really want the compiler to react to code differently depending on what editor it was written in, and depending on what settings the particular editor
Most editors do this... (Score:2)
It seems to me that most editors jump to the current indent level when you press tab - or if not, they should. I can't imagine many people want tabs to really go eight spaces...
But this is why rather than using tab characters in code I've always felt editors should backfill with spaces instead of tabs (outside of editing makefiles of course!)
Comment removed (Score:5, Insightful)
TABs are for TABles! (Score:5, Informative)
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.
Re: (Score:3, Insightful)
I'd disagree there, but to each his own.
Erm, it is still there, just as if it were a space? And some IDEs may even still keep your code lined up and not indent it further than its neighbours, or else it'll behave the same as spaces.
Tabs vs. Spaces (Score:5, Funny)
FIGHT!
close to dropping /. (Score:2)
Tabs are news?
Have you no sense of responsibility to your audience?
What's that old saw? (Score:4, Insightful)
Not just Microsoft... (Score:2)
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.
There are editors that don't let you define arbitrary tab widths? No, seriously -- I'm not sure I've ever seen an editor that didn't provide the option, generally along with the option to have the tab key insert spaces instead of tabs, thereby avoiding that issue and the inevitable problems that arise as tabs and spaces are mixed.
And if that doesn't work, there's this really newfangled tool called indent that you can use...
Tabs = Evil (Score:2)
Plain and simple. If they standardized tabs with a quantity of space chars in all their editors then it is very, very good news. That's the only way to have consistency across all viewers/editors.
The only way to maintain sanity (Score:2, Insightful)
in cross-platform project is to force everyone to use spaces only.
The shit that happens to code with tabs that get edited on unix and windows and different editors make the text to travel towards the right side of screen at exponentially increasing speeds.
Add some retarded editors and direct copying of sources between unix and windows without going through source control system that converts line endings and you will also have empty lines being added as well.
The end result is 1/100 ratio between code and wh
Re: (Score:3, Insightful)
Never had a problem with tabs until spaces get in the mix, and then different conventions completely screw up your code.
In other words, everything is nice and neat with tabs until some asshole starts putting spaces into the code for indentation/alignment :-)
Oh cry me a river (Score:3, Funny)
*sigh*
A Tab is 8 spaces nothing more, nothing less (Score:3, Insightful)
It is really unfortunate the IDE's let people change the tab setting and even more unfortunate that IDE's like Eclipse and IntellJ come with it incorrectly set to 4 spaces. This has the effect of totally buggering the code when viewed in any context other than one with the same settings. Printers and most code viewers use an 8 character tab stop.
Yes things work fine if you forbid mixing tabs and spaces in indent but, in my experience this does not work in practice.
Re: (Score:2)
Also commit policies. Even if it leaves untouched lines alone you might have fiddled with the indenting of a line you didn't intend to commit a change to.
Re: (Score:2)
FWIW, "Brittany" did have this to say:
I would encourage anyone who would prefer VS return to two separate options to vote on this bug, as your feedback can certainly influence decisions about this issue in the future.
So, would the six Microsoft developers reading /. please go and place your votes?
Personally, I find it interesting that the change is about coalescing the "tab stops" and "indent characters" into a single setting and yet discussion has boiled down to a Tabs vs. Spaces debate. Oh that's right, nobody reads TFA around here.
Re: (Score:2, Funny)
Anything else will always get screwed up by someone or some tool.
Why are you repeating yourself?
Re: (Score:2)
Re:Best argument for using spaces (Score:4, Insightful)
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.
Re:Why put tabs in code anyway? (Score:5, Insightful)
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.
Re: (Score:3, Insightful)
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.
Or press shift-tab or undo...
* 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.
I don't think it's really all that hard to automate the process of changing the indent spacing. In my experience, a bigger problem is changing other formatting conventions, such as where to put the line breaks.
* 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.
While I see some value in what you're saying here, I'm doubtful that giving an invisible character semantic meaning is wise. It means you can't tell easily the difference between valid and invalid code. (Yes, I really hate makefile syntax!)
I also note that your latter t
Re:Why put tabs in code anyway? (Score:4, Informative)
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
Re: (Score:2)
Yes yes, Visual Studio 8 barfs when certain project-related files use "\n" line-endings, instead of "\r\n". GNU Make uses its own stupid tab-syntax, and I've never heard anyone praise that decision. However, most major compilers (including Microsoft's) don't care one bit about EOL-style. Every sane programming language allows "\0" or "\000" or "\x00" to represent nonprintables in string literals.
I can't tell if you're being serious or not, but if you look at precedent in developer tools, people do want
How is newline invisible (Score:2)
Yes, yes. Let's all forget about those nasty invisible characters like \r \n and especially \0
\r and \n are quite visible, considering you see another line when an editor encounters them... and generally displays something if it does not understand what they are.
Re: (Score:3, Insightful)
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.
Tabs suck. Use a space. (Score:2)
Re: (Score:2)
Re:Tabs suck. Use a space. (Score:4, Informative)
If you use more spaces for an indent level, even a dead, beaten horse could easily identify the nesting level.
Re: (Score:2)
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.
This is only true if your editor is being stupid. For example, TextMate has a "soft tabs" mode that inserts spaces, but the UI works exactly as if tabs are in use. The same convenience when editing, without the dagger-eyed looks from your collaborators.
Re: (Score:3, Informative)
* 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.
Re: (Score:2)
You know it amazes me. I've been writing code since (oh boy ...) 1970.
I am staggered we are still writing text files for programming. Staggered. No colour, no bolding, no structure.
Really, is this the best we can do?
There ARE languages - Python - that at least do something sensible with formatting, but most do - well - nothing.
Is this really, really, the best we can do?
Re: (Score:3, Insightful)
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 edit
Re:Why put tabs in code anyway? (Score:5, Insightful)
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!
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Stop using said shitty programs dude. If X program doesnt do its job why on earth do you force yourself to use it and adjust your whole workflow to suit it.
Bloody hell.
Are you coding cobol on a 70s mainframe?
Re: (Score:2)
Sure, and it's always wrong.
Re: (Score:2)
How hard is it to find an editor that will handle TABS nicely?
If you are forced to use notepad then jeez, find a way to install scite or something small that works better.
Dont force your self to use a crap editor that is NOT meant for code.
Seriously, thats a poor mans excuse, "because i have to use a shit editor" , get a better editor / viewer. There are 100s of em.
You are forced to edit source on a C-64 40col text editor.
Re: (Score:2)
Sometimes you just want to view code without pulling it into your entire development environment. I use http-based subversion, and I am frequently going to URLs in my web browser to look at code snippets. And seriously, it doesn't take very many people working on a single codebase for tab consistency to start falling apart. All it takes is one person editing one file on a remote machine to screw the pooch.
Re: (Score:3, Interesting)
No, the simple solution is to use spaces for indentation, because then they appear the same everywhere automatically, without forcing you to individually reconfigure every single program you ever use.
Besides, tabs have other purposes. Configuring my shell to display tabs as 2 spaces would break programs that actually use them for their intended purpose, i.e. displaying tables.
Re: (Score:2)
Re: (Score:3, Interesting)
*should* prefer tabs,
No they shouldn't. Tab characters are nothing but an ancient and very primitive text compression scheme. They add zero value.
Tab characters have no defined meaning, are interpreted differently everywhere, usually can't be visually differentiated, break code WYSIWYG, mess up cursor movement, often mess up code alignment, sometimes mess up diff's, sometimes mess up file seeks, are the only ASCII character that requires a complex algorithm to display, interact badly with Unicode and are
Re: (Score:3, Funny)
Three shall be the number thou shalt indent, and the number of the indenting shall be three. Four shalt thou not indent, neither indent thou two, excepting that thou then proceedest on to three. Five is right out.
FTFY
Re: (Score:3, Insightful)
It behaves predictably across editors and allows easy changing of width for various programmers.
I'm amazed that you can utter this with a straight face. "behaves predictably" and "allows easy changing of width" are pretty much diametrically opposed concepts, at least if you actually share your code with any other human being. If tab-width were somehow a universally self-describing attribute in text files, then this could fly. But without it, we're left in a place where others viewing your code open the file (or heaven forbid, use cat/more/less!) and then feel fscked.
I'll also observe that a number
Re: (Score:2)
Re: (Score:3, Funny)
Tabs can be represented by as many "virtual" space characters in the editor as desired by the programmer, allowing them to work with the amount of indentation they prefer without forcing that representation as spaces in the sources. Plus it saves a lot of bytes for those that still save their source code on floppies.
Re: (Score:2)
LOL! I'd mod you funny, but I'm out of points!
Re: (Score:2)
I think I've got to quote Dilbert here: "That must come in handy when someone calls from 1993." :-)
Re:Why put tabs in code anyway? (Score:5, Insightful)
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.
Re: (Score:2)
By forcing all your tabs to be spaces, anyone else viewing the code will be forced to view / edit it in your indentation.
I think that's precisely the point. They've decided what the optimal indentation is and they're going to force everyone else to see it their way.
LK
Re: (Score:2)
Re: (Score:3, Insightful)
That's a valid point, although I'm not sure how you avoid a mixture of tabs and spaces, which would make the code look completely wrong (instead of just a bit wrong!) for everybody else.
Re: (Score:2)
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.
It's still possible with spaces - writing a script that counts the number of spaces at the beginning of each line, divides by N, and multiplies the result by M is trivial in any scripting language. I suspect it would be a one-liner in Perl.
Meanwhile, using tabs to align anything but the beginning of line (i.e. comments) fails utterly, because there you have to rely on a particular width to line things up. But then also there are formatting styles for which you need such alignment even at the beginning of th
Re:Why put tabs in code anyway? (Score:4, Informative)
Re: (Score:2)
So, for all those tab fans, what is it about tabs that you find useful?
When you find yourself debugging an If inside of a For inside of a While inside of an Else, I find it easier to visualize which level in I'm at by the number of tabs.
LK
Re: (Score:2)
How do you see the tabs?
Re: (Score:2)
It's not about the seeing. It's about the number of key presses from the left edge of my screen.
If I arrow to the right four times, then I'm four levels deep.
One...Two...Three...Four
I prefer that to
One...Two...Three...ONE...One...Two...Three...TWO...One...Two...Three...THREE...One...Two...Three...FOUR
LK
Re:Why put tabs in code anyway? (Score:4, Insightful)
Re: (Score:2)
If they're properly coded, they will. Visual Studio certainly does.
Re: (Score:2)
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.
And of course selecting text and using Tab/Shift-Tab to change indenting works just fine if you're not using tab characters. Why wouldn't they?
Re: (Score:3, Insightful)
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 behavi
Re: (Score:3)
I don't have to backspace many times when I remove nested loops
Try Shift+Tab some time (usually applies to selection, or to current line if nothing is selected).
Re: (Score:2)
void foo(bool something)
{
}
Re: (Score:2)
Could you expand on this a little? I don't get it.
Re: (Score:2)
Re:Why put tabs in code anyway? (Score:5, Insightful)
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?
Re:Why put tabs in code anyway? (Score:5, Insightful)
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.
Re: (Score:3, Funny)
You mean you can't see the brilliance of a preview mode that doesn't match what the real thing will look like? ;)
Re: (Score:3, Informative)
I see an ordered, numeric list. What are you seeing?
Re: (Score:2, Insightful)
If you use Tab characters, everybody on your team can pick whatever tab level they prefer. In short, everybody's happy.
If you use Space characters, and you prefer 4 spaces but someone else prefers 2, well, then they're fucked. (Or you're fucked. Somebody's going to be unhappy.)
Frankly, from a logical perspective, I've never figured out what benefit spaces have over tabs... my guess is that it's related to, "I learned programming in 1976 and damned if I'm going to change my extremely ancient and obsolete hab
Re: (Score:2)
If you use Space characters, and you prefer 4 spaces but someone else prefers 2, well, then they're fucked. (Or you're fucked. Somebody's going to be unhappy.)
Bah, you'll get stuck on where to put curly braces after that, anyway. Or whether to have space between keywords and parentheses. Or whether to use parentheses with "return". Or whether to stick * and & to type name or to variable name in declarations. Possibilities are endless, and someone is going to be unhappy no matter what.
Frankly, from a logical perspective, I've never figured out what benefit spaces have over tabs...
Ability to aligning comments on several consequent lines, parameter names in a function declaration, arguments in a call... many things that are impossible with tabs.
Re: (Score:3, Insightful)
From a purely pragmatic perspective, my main problem is simply that I've found it impractical to use tabs consistently. Some lines always wind up having spaces in them instead, and since you can't see the difference, you can't easily fix it.
(Also I don't like seeing eight-character indentation when I need to view the file from the command line or in notepad, but that's a minor point.)
Re: (Score:2)
So, for all those tab fans, what is it about tabs that you find useful?
Re: (Score:2)
The only real problem I have with tabs is when they get used other than for indenting, as a way of inserting three spaces because that was the distance to the next tab stop when the code was last touched. Then somebody inserts characters earlier in the line and bizarre things start happening over to the right. I think its that kind of thing which sometimes get tabs banned in some environments.
Re: (Score:2)
tabs can be displayed any way you like. if you indent with 4 spaces, the tab can be 4 spaces. if you indent with 9 spaces, the tab can be 9 spaces. everyone can configure their own editor the way they like it. if you use spaces, you're forcing your own indenting preference (which is probably stupid and ugly) on everyone else.
Re: (Score:2)
I'm with you. I *hate* tabs embedded in source files. They're nothing but trouble for all the reasons cited in TFA by those who want the setting separated.
I always set the "Insert spaces" option for tabs, and the first thing I do with any legacy code or other code I take over is "untabbify" the entire thing. I've worked to make it part of our coding standards that there be NO TABS in source files.
Tabs provide no benefit, and cause nothing but problems. You are correct: they irritating and utterly unnec
Re: (Score:3, Insightful)
Re: (Score:2)
Uh ... you understand there's a distinction between the tab key and tab characters?
Re: (Score:2)
fewer keystrokes,
Not really. The tab key still works, you understand, it just inserts the appropriate number of spaces.
personalized source code viewing,
That one's valid, except that it requires you to use tabs consistently, which I find hard to do since they're invisible.
and faster to fix tabs when VS messes up. (YES it does happen)
Not sure what sort of mess-up you're talking about, or how tab characters make it faster to fix, so can't comment.
The question that this all brings up is "So, for all those space fans, what is it about spaces you find useful?"
Mainly that they're interpreted the same way by all software. For example, if I happen to open a bit of source code in notepad or type it in a command window, it'll typically
Re:Why put tabs in code anyway? (Score:4, Insightful)
Don't get me started on makefiles. An syntactically significant invisible character? Dumbest idea ever.