Slashdot Mirror


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?"

390 comments

  1. This is news at any level how? by Foredecker · · 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. Okay then...

    How is this tab things news or interesting at all? Here is what Brittany Behrens a PM for the editor team said:

    Hi Brien,

    Thank you for logging this issue. Before making this change we solicited feedback on the decision to combine Tab Size and Indent Size from a wide variety of sources, including public blog posts and forum threads, and found that the vast majority of user feedback was in favor of combining the two. If its seriously impacting your code to have Tab Size always equal Indent Size, it is possible to write a short editor extension to override the Tools->Options dialog and set the two options separately. If thats something youd be interested in, please let me know and Ill see about posting sample code for how to do this.

    Im resolving this issue as By Design because we intentionally combined these options for VS 2010, but please feel free to post again here if you have any further questions or comments and well be happy to help.

    Thanks for trying Visual Studio 2010 Beta 2 and sending your feedback!

    Brittany Behrens

    Program Manager, VS Platform - Editor

    (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!
    1. Re:This is news at any level how? by Anonymous Coward · · Score: 0

      Microsoft gets big attention because they are an industry leader. The relatively small decision of mandatory tab indententation affects many, many people. Jealous much?

    2. Re:This is news at any level how? by j741 · · Score: 3, 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 ;->

      --
      - James
    3. Re:This is news at any level how? by black3d · · 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! :)

      --
      "The true measure of a person is how they act when they know they won't get caught." - DSRilk
    4. Re:This is news at any level how? by oldhack · · Score: 1

      Dude, you are so fired for not clearing with the legal before posting.

      --
      Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
    5. Re:This is news at any level how? by Anonymous Coward · · Score: 0

      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.

      How on earth is that news? Windows has well over 90% of the desktop market, of course their new OS is more popular than all versions of OS X (and Linux, *BSD, AmigaOS, etc). Everyone knows the popularity of windows has more to do with MS' aggressive and unethical "marketing" than with quality...

    6. Re:This is news at any level how? by Wumpus · · 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.

    7. Re:This is news at any level how? by Anonymous Coward · · Score: 0

      Gee, the team solicited comments, did some research and made a change that people wanted.

      This isn't what the customers wanted. They wanted IronPython support and the team interpreted it as people asking for silly tab/indent settings.

    8. Re:This is news at any level how? by Col.+Klink+(retired) · · Score: 3, Informative

      Did you read the blog post where they solicited feedback? It had 9 comments in total. Among them was this comment from the author of the blog (4th comment):

      I assure you we won't be changing that option [tab vs spaces] any time soon :-)

      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.

      --

      -- Don't Tase me, bro!

    9. Re:This is news at any level how? by cgenman · · 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 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.

    10. Re:This is news at any level how? by mgblst · · Score: 0

      Yeah, well I don't want to read Microsoft propaganda as much as I don't want to read Apple propaganda. I still don't like Windows 7/Vista, and probably never well.

      And the fact taht W7, that is bundled with almost every PC sold in the world, has surpassed OS X is not news in the least. It was only a matter of time. If Microsoft released something interesting, like how many people reformat the drive to go back to XP, or how many people who bought Vista down/upgraded to XP, that would be news.

      You do realise that there is a lot of developers here?

    11. Re:This is news at any level how? by Dahan · · Score: 1

      I assure you we won't be changing that option [tab vs spaces] any time soon :-)

      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.

      He didn't say that they weren't planning to change anything. He said that they weren't planning on changing "that option" (tabs vs. spaces). And they haven't--VS still lets you choose whether you want to indent with tabs or with spaces. The change is that if you indent with tabs, the indent must always be one tab, regardless of how many columns each tabstop is. Hardly seems like a onerous limitation to me.

    12. Re:This is news at any level how? by Ciggy · · Score: 1
      Is "popular" the right word? popular suggests that it was deliberately chosen in preference to the other offerings, but as it was delivered (and paid for) with the PC, there is little choice in the matter of the OS [for a PC] - OSX comes with Apple machines only available from Apple; tp use the word "popular", perhaps a better comparison would be to compare the percentages of the different manufacturers?

      Personally I prefer the term "populous" - ie a greater proportion of the "population" (the [statistical] "population" [in this case] being the computers).

      Using Microsoft speak, boys are the more POPULAR babies as more boys are born than girls! Do parents REALLY have that much choice in the sex of their child? However, by the age of 10, girls are the more POPULAR children [as there are more of them] - have parents decided that boys don't make good children and [gender] swapped them for girls? [The real reason has to do with infant mortality.]

      [OPCS data for population figures for England and Wales was the source of the proportions of boys/girls I used above.]

      --

      A rose by any other name would smell as sweet;
      A chrysanthemum by any other name would be easier to spell
    13. Re:This is news at any level how? by dintech · · Score: 1

      4 spaces or death.

    14. Re:This is news at any level how? by Jugalator · · Score: 1

      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...

      That was obvious news to come true after a while, given 7's popularity. This is not obvious news.

      --
      Beware: In C++, your friends can see your privates!
    15. Re:This is news at any level how? by Rogerborg · · Score: 4, Insightful

      That's a very unfair characterisation; there's much more to kdawson than just Microsoft bashing. Specifically, if you have some shitty snake oil vapourware that you'd like to peddle by shilling an advert thinly disguised as an article, he's your guy.

      --
      If you were blocking sigs, you wouldn't have to read this.
    16. Re:This is news at any level how? by A12m0v · · Score: 1

      And this is why I love /.
      A Microsoft product dominating is hardly news worthy, but this is important.

      --
      GENERATION 25: The first time you see this, copy it into your sig on any forum and add 1 to the generation.
    17. Re:This is news at any level how? by westlake · · Score: 1
      Linux (0.90 percent in January 2009) have been gaining.

      0.90 to 1.02 isn't particularly impressive. 0.00 to 5.71 is.

    18. Re:This is news at any level how? by Anonymous Coward · · Score: 0

      BOOM HEADSHOT!!!

    19. Re:This is news at any level how? by delinear · · Score: 1

      You're missing the fact that there is a like-for-like comparison involved here - not Windows 7 to OSX, which was obviously a ridiculous comparison just included to rile people up, but Windows 7 to Vista.

      The fact that 7 is "way hotter than Vista off the line" [sic] is actually quite interesting (disclaimer: I'm no MS apologist, I hated Vista but having received 7 on a new laptop, I've been pleasantly surprised by it), especially considering the massive bad press that Vista generated. Unless of course you're suggesting the sales of PCs have increased substantially in the interim to put early 7 sales ahead of early Vista, during an economic downturn and large-scale unemployment, which I won't contest but which sounds so counter-intuitive to me that I would request a citation - and even then if that's true then it's interesting in itself.

    20. Re:This is news at any level how? by Anonymous Coward · · Score: 0

      He was talking about the option to change tabs in to spaces. This is different than the tab and indent size.

    21. Re:This is news at any level how? by Anonymous Coward · · Score: 0

      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.

      How is that news either? You might as well have the headline, "McDonalds sells more burgers than $premium_burger_chain". The only "story" re: Win7 is that the adoption (from the stats) appears to be significantly concentrated among the Vista userbase.

    22. Re:This is news at any level how? by Waffle+Iron · · Score: 3, 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.

    23. Re:This is news at any level how? by jc42 · · Score: 1

      4 spaces or death.

      Nah; just about everywhere I've worked, 3 was the "standard". I've heard the saying "You can't see the fours for the threes." I've also been impressed by how emotional people can get over such trivia.

      As someone who does a fair amount of web development, and often has to read/edit raw HTML, I've lately found it useful to set my vi(m) tab width to 2, to make the text more readable. I do have one of those little scripts that rewrites HTML (and XML) with tab indenting to show the nesting, and this helps a bit, but the nesting is often so extreme that it's all off the right edge. I prefer 3- or 4-char indenting, but that's no longer practical with the sort of HTML that I have to deal with. I'm wondering if there's another scheme that would make HTML more readable, but I haven't found one.

      Also, I've recently been wondering if any of the common browsers allow setting their tab width. This includes all the things that behave like tabs and result in indentation such as we see in the slashdot discussions. Even with the smallest readable font size (12px) on this 1920x1200 screen, I've seen a lot of discussions here that become unreadable because even in a full-width window, the text is mostly just a thin column on the far right. Yeah, maybe I should stop reading the things that get into politics/religion, but they pop up everywhere. (And there's also that annoying thing that happens occasionally, that makes input boses like this one a very narrow column on the left. ;-)

      If I could set the tab width to 2, or maybe even 1, it would help solve the problem. I've looked around in several of the browsers I use on both my linux and Macbook machines, and I haven't found any tab-stop setting anywhere. Anyone know how to do this with your favorite browsers? Just FF or SM would be enough, though Opera and Safari would also be useful. IE is the last one I test against, so that's less important. ;-)

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    24. Re:This is news at any level how? by Iyonesco · · Score: 2, Interesting

      Well it doesn't matter that nobody commented because they don't actually listen to feedback anyway. Take the example of when they changed the file tab order in VS2005 so that new tabs were added on the right. This change caused all your open file tabs to be pushed along making it impossible to keep track of the location of your file tabs and resulting in users wasting considerable amounts of time looking for files. The person responsible for this was Sara Ford and as you can see from the comments on her blog the response was overwhelmingly negative:

      http://blogs.msdn.com/saraford/archive/2004/05/14/132065.aspx

      Despite all these negative comments both her and Microsoft failed to take any action and no changes were made in the VS2005 service pack or in VS2008. Microsoft simply do not care what users think and and while the may put up the pretence of taking user feedback they always just do whatever they think is best. Sara Ford is a classic example of this and despite all the negative comments on her blog she was totally unable to accept that the change was for the worse. What's most absurd about this situation is that Sara Ford has written a book called "Microsoft Visual Studio Tips: 251 Ways to Improve Your Productivity". Given the she herself is responsible for considerably reducing the productivity of Visual Studio users through her absurd interface design I suspect the only use for this book would be as toilet paper.

      Sara Ford is the personification of everything that is wrong with Microsoft today. When Windows 2000 came out I thought it was extremely good, offering the stability of NT and the software compatibility of 98 while running very fast on the hardware of the day. Since that time Sara Ford Syndrome has set in at Microsoft and the company has been over run with "soft skills" people who have these brilliant ideas to improve usability and in the process have rendered Microsoft's software completely unusable. The user interface changes Windows Vista/7 and Office 2007 have made using the software provably slower, are provably less consistent and are extremely wasteful of desktop space. I'd rather face torture than use Windows 7 or Office 2007 and many others feel the same way but despite the wave of negativity above these new user interface concepts Microsoft continue to push on regardless of their customers' opinions.

      This time however it looks like it's going to cost them since they've split their operating system market into two camps with the vast majority in the XP camp. They're suffering revenue declines since people don't want their newer software, they're losing market share to Apple and they were forced to practically give Windows 7 away with their pre-order discount program to try and generate some positive hype. While 14 year olds may be rushing to Windows 7 with it's cool transparent Windows frames the corporate market is staying well away and have clearly indicated they have no interest in the new software Microsoft is trying to force on the market through their monopoly. By refusing to sell the software customers want and trying to force them to use software they don't it looks like Microsoft's latest monopoly abuse may be what finally brings their monopoly to an end.

    25. Re:This is news at any level how? by plague3106 · · Score: 1

      So the fact that Vista couldn't do it, but 7 has, and both did come bundled? Sorry, what was your point again?

    26. Re:This is news at any level how? by siride · · Score: 2, Insightful

      I'm sure that's it. It's not that Windows runs all the software that people actually use, or that it runs correctly on the computer they buy, or that devices they buy will work with it instead of requiring installation of special programs from God knows where that may or may not work depending on your kernel version, etc. There's plenty of shit on the Windows platform, but at least people who aren't programmers can get work done.

    27. Re:This is news at any level how? by Anonymous Coward · · Score: 0

      cite is C I T E

    28. Re:This is news at any level how? by plague3106 · · Score: 1

      Ya, how nice of you to quote out of context in an attempt to make your point.

      What they said they WEREN'T changing was the Keep Tabs options, which changes spaces to tab. Some people like indenting with tabs, others spaces. Tab size vs indent size was NOT what he was refering to.

      But don't let the facts keep you from ranting.

    29. Re:This is news at any level how? by plague3106 · · Score: 1

      You're assuming that most people even care enough to comment. I never even noticed the change you're bitcihng about. I did notice the new docking feature though, and use it extensively.

      I think you're talking about a vocal minority vs. a silent majority, which don't care or welcome the change.

      You then base your whole rant on something where you don't have all the facts.

    30. Re:This is news at any level how? by maxume · · Score: 2, Informative

      You read it wrong, the only thing he left out was attribution, it isn't some big sekrit:

      https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=517188&wa=wsignin1.0

      --
      Nerd rage is the funniest rage.
    31. Re:This is news at any level how? by plague3106 · · Score: 1

      This contradicts though that netbook returns for Dell were a bit higher because people were expecting windows and got linux. So yes, there are people out there choosing windows over linux. The rest of those linux sales are probably techy people that really did want linux, but I doubt any normal user is asking for linux over windows, even when they know about it.

    32. Re:This is news at any level how? by bondsbw · · Score: 1

      Windows 7 eats into Vista/XP market share. A 5.71% gain in Windows 7 is a 5.71% loss in Windows Vista/XP. Microsoft's market share has increased by 0% because of Windows 7.

      Linux eats into Vista/XP market share. A 0.12% gain in Linux is a 0.12% loss in Windows Vista/XP. Microsoft's market share has been reduced by 0.12% because of Linux.

      Microsoft has not gained any market share. So I'm not sure exactly what you're getting at. They gain profits while losing customers?

      --
      All my liberal friends think I'm a conservative, all my conservative friends think I'm a liberal.
    33. Re:This is news at any level how? by Iyonesco · · Score: 1

      None of Sara Ford's blog posts generate any comments and yet this post had a sizable number of comments. Clearly the people who commented are not regular readers of Sara Ford's blog but are people who have been searching for a way to get VS to revert back to the VS2003 "new tabs on the right" behavior that's used by every other application with tabs (IE, Firefox, Thunderbird, Excel, Kingsoft Office etc). The fact that Microsoft, a company who most definitely don't care in the least about user opinions, has been forced to provide an option in VS2010 to revert back to the VS2003 behavior is evidence enough of the size of the backlash.

      As for you not noticing the change; I simply can't imagine what sort of cognitive state you'd have to be in not to notice such a fundamental change to the way the UI worked. Everyone in my office noticed the change independently this leads me to wonder whether you're actually conscious when you use VS?

    34. Re:This is news at any level how? by Anonymous Coward · · Score: 0

      > Is "popular" the right word? popular suggests that it was deliberately chosen in preference to the other offerings

      "Prolific" is probably a better choice.

      > Personally I prefer the term "populous" - ie a greater proportion of the "population" (the [statistical] "population"

      Except that "populous" already means "having a lot of people," and I don't like the idea of Windows having people rather than people having Windows! ^_^

    35. Re:This is news at any level how? by Impy+the+Impiuos+Imp · · Score: 1

      We just mandated at our company to turn on "convert tabs to spaces" and to use an indent size of 3. Then it became irrelevant what editor one used since it was always spaces.

      The only problem in not having tabs is that it's an extra 2 keystrokes per line to //-comment out a block of code.

      --
      (-1: Post disagrees with my already-settled worldview) is not a valid mod option.
    36. Re:This is news at any level how? by StuartHankins · · Score: 1

      Typical Microsoft astroturfing. And you wonder why Microsoft is considered a tool.

    37. Re:This is news at any level how? by caerwyn · · Score: 1

      From my perspective, this is actually the correct prioritization- did anyone not know by now that Windows 7 has been very well received and is selling well? And, given that, it overtaking OS X in market share is more than a little obvious- if it *hadn't*, it'd be newsworthy.

      Tab handling can be a fairly acrimonious debate among developers, though, so a change to one of the major tools out there for writing code that impacts that debate is, in fact, quite interesting.

      --
      The ringing of the division bell has begun... -PF
    38. Re:This is news at any level how? by thePowerOfGrayskull · · Score: 1

      My assumption is that anyone using Visual Studio is a developer

      Good one. You owe me a new monitor.

    39. Re:This is news at any level how? by mcpkaaos · · Score: 1

      The only problem in not having tabs is that it's an extra 2 keystrokes per line to //-comment out a block of code.

      Tools->Options->Keyboard:

      * In the "Show commands containing" find Edit.CommentSelection.
      * Bind that command to something like Ctrl+/.
      * Assign, OK
      * Move caret to line you want to comment.
      * Hit Ctrl+/.
      * Enjoy life in a world cluttered by one less line of code.

      This works whether you select a line or just move the caret to that line. It also works with several lines at a time.

      --
      It goes from God, to Jerry, to me.
    40. Re:This is news at any level how? by Galestar · · Score: 1

      Is there a "-1 Astroturfing" mod?

      --
      AccountKiller
    41. Re:This is news at any level how? by Foredecker · · Score: 1

      What makes you think I'm astroturfing? Because I work for Microsoft? Are people tha work on Linux posting about Linux being astroturfers? At least call me what I am - an apologist :)

      Dude, the news item was non-news and it made the front page. The contrast I made is called 'irony'. Some slashdotters will make the most picayune criticism of Microsoft and laud the tiniest little new thing in Linux or some other FOSS thing. Many, its so over the top hypocritical.

      Plus, you gotta admit, that was just a low value post. Who uses tabs in their code? Even if they wanted to all they needed to do was write a simple editor extension to fix it. "No Tabs" is baic coding standard 101 - freshman level stuff.

      But he launched a title with a salcious title "Visual Studio 2010 Forces Tab Indenting". Forces? Really?

      Come on... if "you guys" are going to level critisim at me, make it better than that, or calling me an astroturfer. Pick someting orignal or material at least.

      --
      Jibe!
    42. Re:This is news at any level how? by JasterBobaMereel · · Score: 1

      They asked users of Visual Studio .... they did not ask users of other products that have to deal with the mess left by Visual Studio .....

      the whole point of a programming language IDE is that it can interoperate with other systems ..... what is their next step, encode the source so nothing else can compile it ?

      --
      Puteulanus fenestra mortis
    43. Re:This is news at any level how? by RAMMS+EIN · · Score: 1

      And, as always, these numbers may or may not be meaningful ... measure in different places and you'll get different results.

      --
      Please correct me if I got my facts wrong.
    44. Re:This is news at any level how? by plague3106 · · Score: 1

      Unless "this post" generates hundreds of thousands of replies, I'll stick with the vocal minority viewpoint.

      The fact that Microsoft, a company who most definitely don't care in the least about user opinions, has been forced to provide an option in VS2010 to revert back to the VS2003 behavior is evidence enough of the size of the backlash.

      They don't care about user opinions, so they listen to user opinions. Ya, that makes ALOT of sense. I suspect whats going on is they want to shut retards like you up; the "feature" is a trivial checkbox and adds probably 10 lines of code, if that. A small price to shutup morons. Personally, I would add the feature too, just to make idiots like you go away.

      As for you not noticing the change; I simply can't imagine what sort of cognitive state you'd have to be in not to notice such a fundamental change to the way the UI worked. Everyone in my office noticed the change independently this leads me to wonder whether you're actually conscious when you use VS?

      I really couldn't give a flying fuck where my tabs appear, and I suspect the vast majority agree. Seriously, who the fuck cares, since the new tab gets the focus anyway? What kind of moron "software engineering team" HAS FUCKING TIME TO NOTICE SOMETHING LIKE THAT?? Clearly you and your coworkers should be fired, because you have NOTHING TO DO and waste time bitching about where your tabs appear instead of doing your work.

    45. Re:This is news at any level how? by Foredecker · · Score: 1

      I think you misunderstand. This change was just in an options dialog for the code editor. It has nothing to do with how the compiler works, the code generator works, or how Visual Studio interoperates with antying else.

      Its doubly a lame criticmsm as putting tabs in source code is almost universaly considered poor practice.

      --
      Jibe!
  2. Visual Python by c0d3r · · Score: 1

    Visual Python anyone? Doesn't Python force tabbed spacing for scoping?

    1. Re:Visual Python by Anonymous Coward · · Score: 0

      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.

    2. Re:Visual Python by MichaelSmith · · Score: 1

      Python always considers tabs to be 8 spaces regardless of what your editor is set to.

      Well its not psychic, isn't it?

    3. Re:Visual Python by broken_chaos · · Score: 4, 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.

    4. Re:Visual Python by Capsaicin · · Score: 1

      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 had in place a the time it was written, would you?

      In any case, as PEP 8 makes clear, the 8 space/tab equivalence is there for "really old code that you don't want to mess up." The official recommendation is to "[u]se 4 spaces per indentation level" and that "[f]or new projects, spaces-only are strongly recommended over tabs."

      With any halfways decent editor (ie. vim instead of vi :o) one should really never feel the need to touch the [Tab] button for the sake of indenting code. Of course Visual Python would throw the cat among the pidgeons now.

      --
      Better to be despised for too anxious apprehensions, than ruined by too confident a security. --Edmund Burke
    5. Re:Visual Python by shutdown+-p+now · · Score: 1

      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.

  3. Most editors do this... by SuperKendall · · Score: 1

    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!)

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:Most editors do this... by aflag · · Score: 1

      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...

      It's actually quite common, though. Linux' coding style text states that 8-spaces-wide tabs are the standard. It seems to me that it's also the way people work in OpenBSD's code as well. I personally like 8-space-wide tabs for C code. For C++ and Python I rather use 4 spaces because I feel there is usually more nesting in those languages.

    2. Re:Most editors do this... by mysidia · · Score: 1

      The real crux of the issue is not necessarily what the tab key does, but how embedded tabs are treated and displayed when opening a file, be it a .C file, a header file, resource file or text file in the VS editor.

    3. Re:Most editors do this... by orzetto · · Score: 1

      Y'know, that was my reason for using tabs. Now I prefer spaces for the same reason: I don't want to allow anyone to edit the code with 2-spaces indent, lest they nest code in 5 or 6 levels.

      Also, with tabs you cannot enforce a maximum width of, say, 80 characters per line (which is great: you can have several editor windows side by side).

      --
      Victims of 9/11: <3000. Traffic in the US: >30,000/y
    4. Re:Most editors do this... by Anonymous Coward · · Score: 2, Insightful

      It also makes lining up parameters on multiple lines look like complete and utter ass because that usually requires a combination of tabs and spaces.

    5. Re:Most editors do this... by plague3106 · · Score: 1

      I had a CS instructor that insisted on indenting with tabs; they liked to use whatever editor, and didn't want to scroll horizaonally for pages on pages. Spaces would do that, but tabs where he set the tab size would not.

  4. Tabs vs. Spaces by dziman · · Score: 5, Funny

    FIGHT!

    1. Re:Tabs vs. Spaces by Anonymous Coward · · Score: 0

      IANAP (yet), but Elastic tabstops look nifty. would totally suck unless every editor supported them though.

    2. Re:Tabs vs. Spaces by rastos1 · · Score: 1

      http://googlefight.com/index.php?lang=en_GB&word1=tabs&word2=spaces

      Spaces win.

    3. Re:Tabs vs. Spaces by osu-neko · · Score: 2, Funny

      Well, sure, if you're going to count raw numbers. There's like four or even eight spaces for every tab. :p

      --
      "Convictions are more dangerous enemies of truth than lies."
    4. Re:Tabs vs. Spaces by Anonymous Coward · · Score: 0

      As you can plainly see, MS did not do any true research on this matter.

      http://www.googlefight.com/index.php?lang=en_GB&word1=Tabs&word2=Spaces

      Spaces FTW!

  5. Best argument for using spaces by smoot123 · · Score: 1

    It's things like this that convinced me using spaces is the only way to fly. You also need an editor that knows how to indent to the right place by inserting the right number of spaces (i.e. not vi out of the box or notepad). Anything else will always get screwed up by someone or some tool.

    1. Re:Best argument for using spaces by Sehnsucht · · Score: 2, Funny

      Anything else will always get screwed up by someone or some tool.

      Why are you repeating yourself?

    2. Re:Best argument for using spaces by God+of+Lemmings · · Score: 1

      Yep, it happens so much our workplace standardized on 3 space indentation; absolutely no tabs in the code.

      --
      Non sequitur: Your facts are uncoordinated.
    3. Re:Best argument for using spaces by nullchar · · Score: 3, 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.

    4. Re:Best argument for using spaces by poopdeville · · Score: 1

      Unless you're being sensible and are actually tabulating your code. Why do you think I want to read your shitty poetry (stanza-form) when I could be checking off properties about a table (tabular form)?

      --
      After all, I am strangely colored.
    5. Re:Best argument for using spaces by Haeleth · · Score: 1

      And if you prefer to look at 2 or 4 spaces per tab, you're hosed.

      And if you seriously care about code being indented one space more or less, then maybe you need to get over yourself. Formatting is not actually a big deal. You can get used to any indentation width in a few days once you stop kicking and screaming. Be grateful your code base has indentation at all; I've seen plenty that didn't, or that apparently chose indentation levels according to the phase of the moon.

      In any case, indentation width is only one of many style settings. Using tabs instead of spaces doesn't shift braces around, or add/remove space around operators/parentheses, or rename functions to use underscores or camel case.

    6. Re:Best argument for using spaces by incripshin · · Score: 1

      So throw out the 80-column rule, then? And what of statement-line-break indentation? I use BSD KNF, so I indent blocks at mod-8 offsets and broken lines are at mod-4 offsets. It doesn't work when you change the sizes of tab stops. The idiots that keep redefining the tab character are fucking it up for everybody.

      // vim: set tabstop=8 softtabstop=4 shiftwidth=8 noexpandtab: ftw

    7. Re:Best argument for using spaces by KnownIssues · · Score: 1

      Look you guys are making this harder than it needs to be. Just set your tabs to be the width of one space then use two tabs!

    8. Re:Best argument for using spaces by ClosedSource · · Score: 1

      "So throw out the 80-column rule, then?"

      Not if you're still using dumb terminals.

    9. Re:Best argument for using spaces by Anonymous Coward · · Score: 0

      And how would you not mix spaces and tabs?

      Having anything depend on an invisible character that looks exactly like other invisible characters is just stupid (here's lookin' at you, Makefile).

    10. Re:Best argument for using spaces by incripshin · · Score: 1

      http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6-stable.git;a=blob;f=Documentation/CodingStyle;h=8bb37237ebd25b19759cc47874c63155406ea28f;hb=HEAD

      Now, some people will claim that having 8-character indentations makes
      the code move too far to the right, and makes it hard to read on a
      80-character terminal screen. The answer to that is that if you need
      more than 3 levels of indentation, you're screwed anyway, and should fix
      your program.

      And yes, sometimes I do read and write code on 80-character terminals.

      I've discovered something nice about using this in C++. The body of a function defined inside a class is implicitly inline, and so it should be very simple. The extra initial indentation immediately gives less space for any complicated functions.

    11. Re:Best argument for using spaces by smoot123 · · Score: 1

      As long as you don't mix spaces and tabs, you're fine.

      That's where things don't work for me. I don't like to always line things up on rigid tab stops. But you're right, if you always use only one or the other, things work out fine.

    12. Re:Best argument for using spaces by ClosedSource · · Score: 1

      Are those real hardware terminals? :)

      I'm not a big believer in coding standards perhaps because I've had to adhere to so many different ones. I even think consistency is overrated.

      I think it's more a matter of programmers' obsessive need to organize for the sake of organization. Of course, forcing others to use your style strokes the ego as well.

    13. Re:Best argument for using spaces by Wizworm · · Score: 1

      This only works for fixed width fonts.. otherwise

      OOOO\tiiii doesnt line up with
      iiii\tOOOO

      --
      I always thought of Creationism as the Raving Right's version of the Loony Left's Anthropogenic Global Warming-brightmal
    14. Re:Best argument for using spaces by nullchar · · Score: 1

      As long as you don't mix spaces & tabs, variable-width fonts will display just fine. All the more reason to use tabs-only, since you can define its width much more easily than a space. (And variable-width font spaces are usually narrow).

      function foo(param bar) {
      \t if (bar is not null) {
      \t\t print(bar);
      \t }
      }

  6. Why put tabs in code anyway? by harryjohnston · · Score: 1, Offtopic

    One of the first things I've always done when setting up Visual Studio on a new computer is to set the option to insert spaces instead of tab characters. I find tab characters, to put it bluntly, irritating and utterly unnecessary. (You can imagine my opinion on standard makefile syntax!)

    So, for all those tab fans, what is it about tabs that you find useful?

    1. Re:Why put tabs in code anyway? by mgkimsal2 · · Score: 4, 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.

    2. Re:Why put tabs in code anyway? by Artraze · · 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 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.

    3. Re:Why put tabs in code anyway? by Dan+East · · Score: 2, 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.

      --
      Better known as 318230.
    4. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      1) select several lines
      2) press tab
      3) lines have one more indentation level (depends on your IDE of course)
      ---
      1) select several lines
      2) press space
      3) ???
      4) no profit

    5. Re:Why put tabs in code anyway? by Buttink · · Score: 1

      fewer keystrokes, personalized source code viewing, and faster to fix tabs when VS messes up. (YES it does happen) The question that this all brings up is "So, for all those space fans, what is it about spaces you find useful?" Randomly asserting your right is FUN!

    6. Re:Why put tabs in code anyway? by yvajj · · 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.

    7. Re:Why put tabs in code anyway? by Lord+Kano · · Score: 1

      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

      --
      "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
    8. Re:Why put tabs in code anyway? by Nikker · · Score: 3, Insightful

      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.
    9. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      makefile... If you ever have to hand edit one, you'll find that it refuses to work with spaces instead of tabs.

      Don't ask me why, but the open source people are inflexible about their version of make.

    10. Re:Why put tabs in code anyway? by Lord+Kano · · Score: 1

      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

      --
      "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
    11. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Using tabs means I'm not a fag. Just sayin.

    12. Re:Why put tabs in code anyway? by TrancePhreak · · Score: 1

      If you need to go back and comment out some lines or something then spaces will screw up and tabs will not.

      void foo(bool something)
      {
      ..if (something)
      ..{
      //....int blah = 0;
      //....void* v =
      ....something = false;
      ..}
      }

      --

      -]Phreak Out[-
    13. Re:Why put tabs in code anyway? by TrancePhreak · · Score: 1

      You can still set the indentation. They are merely merging tab size & indentation.

      --

      -]Phreak Out[-
    14. Re:Why put tabs in code anyway? by nmb3000 · · Score: 5, Insightful

      So, for all those tab fans, what is it about tabs that you find useful?

      1. I can have my indent be 2 spaces and you can have it be 8 spaces, all without changing the source code.
      2. Files are not constantly being changed and updated in the source control system due to the number of spaces changing as different developers edit the code.
      3. If I want to print out a section of code, I can modify the tab/space equivalency so that the lines easily fit on the page without wrapping.
      4. Tabs provide a one-to-one relationship between the level of indentation and the number of characters used. This isn't usually a big deal, but in terms of parsing and editing I personally find this more elegant than using spaces (an inconsistent many-to-one relationship).
      5. It saves electrons. One tab character generally fills the shoes of four space characters. That's a savings of 75%! Smaller storage and transmission requirements means fewer servers in the datacenter which means less heat created which means smaller refrigeration units which means less energy consumed which means fewer greenhouse gases emitted which means less global warming which means continued survival of the human species.

      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
      /)
    15. Re:Why put tabs in code anyway? by Blakey+Rat · · 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 habits for you young un's. Also, get off my lawn!!"

    16. Re:Why put tabs in code anyway? by scdeimos · · Score: 2, Insightful

      You're confusing the tab key with the tab character. Do you expect to see arrow characters in your code when you use the arrow keys on your keyboard too?

    17. Re:Why put tabs in code anyway? by harryjohnston · · Score: 2, 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 two points only apply if the tab size is also the indent size.

    18. Re:Why put tabs in code anyway? by mrboyd · · Score: 1

      So, for all those tab fans, what is it about tabs that you find useful?

      • When I want to dedent I can press del once, not four times.
      • I like my code when the indent size is about 4 space wide, my neighbor likes his code cramped at 2 spaces and some other weird people like it at 8 spaces. With tab and the editor settings we can all get what we want. Without generating a whole file modification changeset each time we decide to disagree on code spacing.
      • ~15% in code file size reduction. I know, who cares, but still.. It feels cleaner.
      • The key is called "Tab" when I press it I want a \t not random number of spaces. I don't care that VT-XYZ did not support it in 1980.

      What are the benefits of using spaces in 2010? The only rational I've heard is that back in the time of computer dinosaurs some editors only knew how to render tab with 8 spaces and that was too much for the people who had 80 columns screens so they decided to type 4 spaces instead of using the tab character. So more code would fit on their screen.

    19. Re:Why put tabs in code anyway? by harryjohnston · · Score: 4, 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!

    20. Re:Why put tabs in code anyway? by nmb3000 · · Score: 4, 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.

      --
      "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
      /)
    21. Re:Why put tabs in code anyway? by MichaelSmith · · Score: 1

      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.

    22. Re:Why put tabs in code anyway? by avxo · · Score: 1
      Dan East wrote:

      Plus it saves a lot of bytes for those that still save their source code on floppies.

      LOL! I'd mod you funny, but I'm out of points!

    23. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      I think I've got to quote Dilbert here: "That must come in handy when someone calls from 1993." :-)

    24. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      Uh ... you understand there's a distinction between the tab key and tab characters?

    25. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      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 look just right if I've used spaces, and unreadable if I've used tabs.

    26. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      How do you see the tabs?

    27. Re:Why put tabs in code anyway? by harryjohnston · · Score: 2, 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.

    28. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      If they're properly coded, they will. Visual Studio certainly does.

    29. Re:Why put tabs in code anyway? by harryjohnston · · Score: 3, Insightful

      Don't get me started on makefiles. An syntactically significant invisible character? Dumbest idea ever.

    30. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      Could you expand on this a little? I don't get it.

    31. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      You need to use spaces for fine-indenting on line continuations anyway. May as well just use them the whole time instead of having a mixture.

      What I mean by that is say I'm calling a function with numerous arguments, so I start a new line partway through. With using only tabs, the majority of the time you will not be able to get the second row of arguments to start at the same position as the first row of arguments and it will look ugly, so you need to fine tune the line with spaces. On top of that, you can't tab as far as possible and then fine-tune, because then if someone else views the file with a different tab-size, it will be off. You need to run out the same amount of tabs as you had on the previous line and then use spaces the rest of the way to keep things in synch.

    32. Re:Why put tabs in code anyway? by MikeFM · · Score: 1

      What I hate most is cutting and pasting tabs. One program will treat it as a tab, another as x number of spaces, and another as y number of spaces. It's horrible. If you use spaces you know what you are getting.

      --
      At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
    33. Re:Why put tabs in code anyway? by Bill+Dog · · 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? ;)

      --
      Attention zealots and haters: 00100 00100
    34. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Exactly. In my place, tabs are used for indentation and spaces are used for formatting. It stops the bullshit that some like 2 space indent, other likes 3 and some other may prefer 4 or 6 or even 8.

      To make sure everyone knows what they are using and not to fsck up, spaced/tabs visualization is enabled.

    35. Re:Why put tabs in code anyway? by JimboFBX · · Score: 1

      I think its an old person new person thing. People who are used to programming with 80 chars being their monitor's limit are also used to the default tab size being like 5 spaces or so and they probably never figured out how to change that size and save it. New people who grew up with a monitor that manages more than 800 pixels horizontally and with an operating system that you can alt-tab with *should* prefer tabs, but it appears some people still hang on to old ideas, probably because some 40 year old or 50 year old told them spaces was better, or more likely their preferred editing software by default inserts 3 or 4 spaces when they hit tab and they dont want to admit they never learned how to change that in the options.

      The rule in programming classes should ALWAYS be:

      Tab up to the first non-white space character then use spaces for things that follow.

    36. Re:Why put tabs in code anyway? by d3matt · · Score: 1

      For your second point...
      What happens when you put tabs after the start of the line to make columns? Spaces would stay lined up as long as you use a fixed width font. Tabs cause the column spacing to change (when you change the tab size) depending on how much text is in each column.

      I do prefer tabs for the other two stated reasons; also GNUmake forces the issue, and Python recommends the use of tabs.

      --
      I am d3matt
    37. Re:Why put tabs in code anyway? by John+Whitley · · Score: 1

      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.

    38. Re:Why put tabs in code anyway? by John+Whitley · · Score: 2, 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 of popular editors don't even have clean per-project (or per-file) concepts of tab-width setting and such settings are often clunky in the best of those that do.

    39. Re:Why put tabs in code anyway? by daVinci1980 · · Score: 0

      Spaces work better than tabs because the code is always formatted properly. Code that is formatted improperly does not do what you think it does. This matters a lot when you have projects developed by 200+ developers with multiple millions of LOC. It matters even more when you have 3000+ developers working on many such code bases and they move between said projects with high frequency.

      You cannot have your indent be two and me with 8 and have the code line up properly, especially when lining up complex if or math statements (where you may be using the level of indent to help with showing how the parens or operators nest). While you could argue "then split into multiple statements", I could argue "it's actually more readable as is". Subjective is neat that way.

      Files that are being constantly updated because someone doesn't like someone elses formatting is dumb. Have a standard, stick to it. Fire the offender who refuses to play ball, problem solved.

      Who prints code? Fine, let's say you do. Modifying the number of spaces per tab causes the issue I pointed out at phase 1.

      Relationship argument makes no sense to me, sorry. Where the code lines up is what matters to me, not how many invisible characters appear between the beginning of the line and the first character.

      --
      I currently have no clever signature witicism to add here.
    40. Re:Why put tabs in code anyway? by JimboFBX · · Score: 1

      Why would knowing the number of spaces ever be important when you are writing indentations in code? I mean, do you make comments with arrows that move horizontally and then point up or down to the beginning of the code they are referring to or something?

    41. Re:Why put tabs in code anyway? by weicco · · Score: 3, 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

      --
      You don't know what you don't know.
    42. Re:Why put tabs in code anyway? by JimboFBX · · Score: 1

      Do you draw naked ladies in your code or something and insist on using the tab key for white space? Explain how if I like my tabs to be 2 spaces and I am sharing code with someone who likes 5 spaces, that we can get along unless we both use tabs and have our editor of choice configured to use our preferred number of spaces?

    43. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      1 ASCII character vs N characters.

    44. Re:Why put tabs in code anyway? by Punto · · Score: 1

      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.

      --

      --
      Stay tuned for some shock and awe coming right up after this messages!

    45. Re:Why put tabs in code anyway? by JimboFBX · · Score: 1

      He forgot to use the code tag. Except his example using "..." to represent a section of whitespace just shows he's not only new around here, but to coding as well. Never tab after non-white space characters. In his example he stuck the "//" at the beginning of the line and was indenting after it.

    46. Re:Why put tabs in code anyway? by SpryGuy · · Score: 1

      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 unnecessary.

      --

      - Spryguy
      There are three kinds of people in this world: those that can count and those that can't
    47. Re:Why put tabs in code anyway? by nhytefall · · Score: 1

      Programmers.... always telling us what to do.

      --
      0100010001101001011001 0100100000011010010110 1110001000000110000100 1000000110011001101001 0111001001100101
    48. Re:Why put tabs in code anyway? by poopdeville · · 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.

      --
      After all, I am strangely colored.
    49. Re:Why put tabs in code anyway? by cheekyboy · · Score: 1

      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.

      --
      Liberty freedom are no1, not dicks in suits.
    50. Re:Why put tabs in code anyway? by cheekyboy · · Score: 1

      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?

      --
      Liberty freedom are no1, not dicks in suits.
    51. Re:Why put tabs in code anyway? by SpryGuy · · Score: 1

      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?

      --

      - Spryguy
      There are three kinds of people in this world: those that can count and those that can't
    52. Re:Why put tabs in code anyway? by poopdeville · · Score: 1

      I would be annoyed if I was a 5-space using user, and downloaded somebody's code, and found that it flowed off the screen because of 2-space nesting in the author's environment... I would rather see 2-space nesting than 5, in that case.

      --
      After all, I am strangely colored.
    53. Re:Why put tabs in code anyway? by poopdeville · · Score: 1

      When did \n become a visible character? Just about every language I know of uses \n as a syntactically significant character... spaces are syntactically significant in most mainstream languages too. You always need at least one between tokens, right? That makes them syntactically significant.

      --
      After all, I am strangely colored.
    54. Re:Why put tabs in code anyway? by Mad+Merlin · · Score: 1

      If you use spaces you know what you are getting.

      Sure, and it's always wrong.

    55. Re:Why put tabs in code anyway? by smellotron · · Score: 1

      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 to forget about all of those nasty invisible characters. The benefits of making them semantically meaningful are dramatically outweighted by the complexity of making sure every editor uses the same semantics.

    56. Re:Why put tabs in code anyway? by poopdeville · · Score: 1

      Have you ever tabulated your code? Do you see that it offers readability and maintainability? Perhaps it is counter-intuitive, but using tabs to tabulate code is counter productive. The columns you will tabulate are typically not same-sized. So you will have to use spaces to bring columns into alignment. What happens when somebody comes and views your code with tiny or large tab stops?

      I suppose I shouldn't care too much. It is 100% their problem at that point. But they are effectively undoing your work.

      --
      After all, I am strangely colored.
    57. Re:Why put tabs in code anyway? by bit01 · · Score: 2, 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 just a waste of time.

      If you want your code pretty printed with a certain indentation then run it through a pretty printer. Trying to get tabs to do this for you is a hack that should've died years ago.

      The first thing I usually do with any body of code I've been given to maintain is to remove all tabs and trailing spaces and if necessary run it through a pretty printer. I also configure my editor to not to insert tab characters and configure the tab key to indent as appropriate.

      Please, just stop using tab characters. They make code harder to maintain and are a pain.

      ---

      Monopolies = Industrial feudalism

    58. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      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...

      So you hit tab, instead of adding the indent char it adds X spaces, then I open it in another editor, and in order to remove the indent you want me to press shift+tab? That just removed the last tab I put in but not the spaces you put in. And the undo keeps saying "nothing to undo" gee imagine that.

      Parent is correct, space is for defining the end of one word to differentiate it from the next: Tab is a formatting character. Inserting spaces when someone hits tab is lazy and plain old retarded.

    59. Re:Why put tabs in code anyway? by shutdown+-p+now · · Score: 1

      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 the line. For example, in C, putting the first function parameter on the same line as opening parenthesis, and lining the rest up under it:

      void
      foo(int x,
          float y,
          char* z);

      Go ahead, try that with tabs of size unknown in advance. Oh, and while the above may not be common formatting for C code, somthing similar is a de facto standard for some languages out there (e.g. Haskell, F#)

    60. Re:Why put tabs in code anyway? by smellotron · · Score: 1

      Dont force your self to use a crap editor that is NOT meant for code.

      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.

    61. Re:Why put tabs in code anyway? by shutdown+-p+now · · Score: 2

      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).

    62. Re:Why put tabs in code anyway? by shutdown+-p+now · · Score: 1

      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.

    63. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Tab up to the first non-white space character then use spaces for things that follow.

      On the other hand I'd rather be thinking about the code and not whether I used the right combination of invisible characters (adding little glyphs to indicate tabs seems like the tail wagging the dog). Your recommended style requires a highly specialised editor or code formatter, at best.

    64. Re:Why put tabs in code anyway? by Lord+Kano · · Score: 1

      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

      --
      "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
    65. Re:Why put tabs in code anyway? by SimonInOz · · Score: 1

      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?

      --
      "Cats like plain crisps"
    66. Re:Why put tabs in code anyway? by smellotron · · Score: 1

      Speaking as a musician, I must correct you:

      ONE two three four TWO two three four THREE two three four FOUR two three four

      Or if you want to move faster, this rolls off the tongue easier:

      ONE ee and ahh TWO ee and ahh THREE ee and ahh FOUR ee and ahh

      Or if you're using 2-space tabs:

      ONE and TWO and THREE and FOUR and

    67. Re:Why put tabs in code anyway? by ThatMegathronDude · · Score: 1

      Just because some languages made a poor style decision, doesn't mean that we should all suffer. That cascading function definition is awful, keep it on one line.

    68. Re:Why put tabs in code anyway? by ThatMegathronDude · · Score: 1

      Spaces are always one blank space. Tabs can be several.

    69. Re:Why put tabs in code anyway? by poopdeville · · Score: 1

      You're a fool if you think something like

      data User = User { login_id :: LoginId
                        , login_password :: Password
                        , first_name :: Maybe FirstName
                        , last_name :: Maybe LastName
                        , email_address :: Maybe EmailAddre
                        , user_permissions :: [ Permission ]
                        } deriving (Data, Eq, Ord, Show, Typeable)
      is "awful". The only thing that is awful is how it looks when I paste it into the slashdot comment system, and the fact that it took me nearly a minute to get it to render the way it does on Slashdot.

      User is a type. It's a function (a so-called data constructor) with a bunch of arguments of various types. I'll pass on your "one line" suggestion.

      Unfortunately, it appears that TextMate has been using

      --
      After all, I am strangely colored.
    70. Re:Why put tabs in code anyway? by Toonol · · Score: 1

      "Should"? They're wrong because they're "old"? Or because they "never learned how to change the options"?

      Christ, I know asserting that your opinion is correct is fun, but listen to yourself.

    71. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Use a real programmer's editor.


      set listchars=tab:.\ " show tabs as "." followed by space
      set list " show aforementioned characters

      Those who misunderstand tabs are destined to abuse them, or switch to spaces out of frustration.
      It doesn't change the fact that they don't understand how to use tabs.

      The _real_ downside to tabs is everyone else --
      all it takes is one sloppy editor who improperly mixes tabs and spaces to ruin it for everyone else.

      (regarding the above hint; it's better to use a unicode symbol instead of "." dot.
      slashdot eats unicode chars, hence the example doesn't show it)

    72. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      All indents shall be in steps of 3 spaces. Setting your indent step to 4 - or God forbid, 5 - spaces shall be punishable by death.

    73. Re:Why put tabs in code anyway? by poopdeville · · Score: 1

      Why micromanage spaces and alignment when that's what computers are good for?

      It would be nice if computers were good at finding a tabular normal form for code. But they're usually not. So you either end up with code in "stanza form", which is as hard to read as shitty poetry, or you find the normal form yourself by sticking spaces in appropriate places using "visual mode".

      --
      After all, I am strangely colored.
    74. Re:Why put tabs in code anyway? by Your.Master · · Score: 1

      To be fair, alignment issues could be resolved by using tabs to indent, and then spaces for the fine-grained spacing within the code.

      Of course, that also means that there are inevitably going to be invisible, non-syntactic "mistakes" in the code that will cause people with editors set to different tab-stops to see different results.

      The solution to that would be language-aware auto-indenter which runs before checkin, but once you have that you can have all the benefits of tabs with pure spaces anyway (you just have to apply its inverse on each sync to source).

      I prefer spaces precisely because it *isn't* different for everybody, which reduces the possibility of miscommunication, and code is a place for precision. Still, I'm happy so long as the source is consistent.

      Also, I find it easier to use the "find" functions in editors when there are leading spaces, simply because the tab key is so often used for keyboard accessibility in the find dialog or what-have-you that comes up, so I've got to paste in a tab character or remember whatever arcane command this application on this OS uses to type a tab. I could use a regex or similar, but that's often overkill, and that also has the problem that every damn program has slightly different regex syntax.

    75. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Some text editors allow you to actually see the tab character.
      It's actually quite helpful when editing Makefiles.

      http://vim.wikia.com/wiki/Highlight_unwanted_spaces

      See, specifically, the "listchars" section.

      It's also good for editing Python because tabs are typically a mistake in the PEP-8 4-space-indent world.

    76. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      You're right that tabs are better. They let every developer configure the indentation level to their liking, very useful for different setups, printing, etc. However, there's a very good reason to use spaces instead: a lot of developers don't understand how to use tabs properly (for indentation ONLY) and they use tabs to line up comments and otherwise create column-aligned text where spaces should have been used. Then when someone with a different tab width opens the same file, it looks wickedly ugly. Then they complain about how dumb tabs are.

      This is why we can't have nice things.

    77. Re:Why put tabs in code anyway? by The+New+Andy · · Score: 1
      No, you should use tabs all the way up to the indentation level you are at, and then use spaces if needed for vertical alignment, and then write what you want.

      If you use tabs for aligning stuff, then it breaks when you change the size of a tab.

    78. Re:Why put tabs in code anyway? by pclminion · · Score: 1

      The reason is that without it, the make language would be ambiguous. It would have no way of determining where the end of the command set is. The beginning of the next rule would be indistinguishable from a continuation of the previous command set. Had the language required some kind of separator or terminator between rules, the significant tab would not be necessary. Alas.

    79. Re:Why put tabs in code anyway? by emt377 · · Score: 2, Insightful

      How hard is it to find an editor that will handle TABS nicely?

      It's not just about editors, but about terminal windows as well. Just such a simple command as "svn diff file.c | more" will indent at 8 stop tabs, causing unreadable wrapping. The problem is everything from Terminal.app (or gnome-terminal or whatever you use) to 'more', to diff vewiers, web svn tree browsers, trac, post-commit email, etc, has to be made aware of non-8 stop tabs and keep your individual preference. This is turn adds a need for login (or navigation options) - and just adds bloat and complexity for something that has a very simple solution: use spaces.

    80. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      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...

      So you hit tab, instead of adding the indent char it adds X spaces, then I open it in another editor, [...]

      You realize you just changed the scenario?

      and in order to remove the indent you want me to press shift+tab?

      Not unless that's the unindent key in the editor you're using, no.

      That just removed the last tab I put in but not the spaces you put in.

      Out of curiosity, what editor interprets shift-tab as "remove a tab" as opposed to "remove a level of indentation"?

      And the undo keeps saying "nothing to undo" gee imagine that.

      Well, duh.

      Parent is correct, space is for defining the end of one word to differentiate it from the next: Tab is a formatting character. Inserting spaces when someone hits tab is lazy and plain old retarded.

      OK, retarded is a matter of opinion, but how do you get lazy?

    81. Re:Why put tabs in code anyway? by IBBoard · · Score: 1

      Eclipse has "code cleanup profiles" to handle that. Not sure about VS.Net - the last I used was 2005 and it was somewhat lacking in that area.

      Or you just tell your developers "use tabs because tabs let everyone get what they want" and slap the ones who insist on using spaces until they do it right ;)

    82. Re:Why put tabs in code anyway? by styrotech · · Score: 1

      ..., and Python recommends the use of tabs.

      PEP 8 (the Python style guide) disagrees...

      For new projects, spaces-only are strongly recommended over tabs. Most editors have features that make this easy to do.

    83. Re:Why put tabs in code anyway? by JimboFBX · · Score: 1

      isn't the simple solution to configure your shell to display tabs as less than 8 spaces?

    84. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      I'm not forced to use notepad, or the DOS console window, but it sure is convenient to be able to when I'm in a hurry. (I'm often using computers other than my own, so installing some oddball piece of software isn't really a sensible option.)

      Besides, it isn't just notepad; most editors will, by default, assume 8 character tabs. I indent to two characters.

    85. Re:Why put tabs in code anyway? by osu-neko · · Score: 1

      Eh? That sounds almost exactly backwards. Back in the 80s, I don't know anyone who preferred spaces. We used tabs because any decent text editor let you set them as you liked, and tab meant indent, a semantic meaning that made sense in the context of a source code file. Getting into the 90s, however, you started seeing people coding in primitive GUI environments that were horrid at getting formatting to work right, people wanted to start cutting and pasting rather than marking and copying/moving blocks of text like you do in a text editor, and things would turn into horrid messes if you used tabs instead of spaces, so these younger "new people" started insisting people use spaces instead of tabs because they couldn't figure out how to use a proper text editor that didn't resemble a word processor. It's these young people who never figured out how to properly use a text editor that started insisting on spaces, while us old-timers never had a problem with tabs.

      --
      "Convictions are more dangerous enemies of truth than lies."
    86. Re:Why put tabs in code anyway? by Menkhaf · · Score: 1

      The only thing that keeps users (us) coming to this site, is the name.

      Oh, the irony of a website dedicated to nerds being such a mess. Where's my unicode support?

      To add to the discussion, using tabs over spaces saves Slashdot some bandwidth. Have a look at the "menu" ul -- li's are seperated by 6 lines of 4 tabs. That's 24 tabs, or what would be 96 spaces to seperate items. Have a look for yourself, Slashdots filter makes a mess of it. At least in the preview...

      You see that? Just think of how many bytes would go to printing spaces if they didn't use tabs!

      --
      A proud member of the Onion-in-Hand alliance
    87. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      My god - do you really have to indent every line manually?

    88. Re:Why put tabs in code anyway? by osu-neko · · Score: 1

      It should be noted that at least half of the arguments you make are exactly identical to arguments I always make, save that they're arguments for using tabs instead of spaces. The one that annoys me the most is how using spaces utterly messes up cursor movement. Ugh. Fixing the problem should be easy, but it's frequently a pain, as a quick find/replace macro to restore sanity to the file often reveals just how sloppy space-indenters usually are. Tab indenters use one tab for one indent level, two tabs for two indent levels, etc. Space indenters say they use four space for one indent level, eight for two levels, etc, but any attempt to clean up their code quickly reveals that sometimes they use seven or nine accidentally, or a poor cut and paste or something, who knows, all I know is whenever I find extraordinarily sloppy indenting, sure enough, it's the product of one of those sloppy space-indenters. Tab-indented code always comes up pretty clean. Replacing all those spaces with tabs, making the code much easier to maintain, is one of the things I always do before recommitting the code.

      --
      "Convictions are more dangerous enemies of truth than lies."
    89. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      OK, OK, if you're going to be pedantic:

      A syntactically significant character that is indistinguishable from a series of spaces? Dumbest idea ever.

    90. Re:Why put tabs in code anyway? by osu-neko · · Score: 1

      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. ...

      Actually, the concepts go quite well together, and it's the latter part about easily changing widths that makes it much easier to share your code with others. Why do you think the concepts are opposed? Are you confusing "behaves predictably" with "appears identically", two completely orthogonal concepts?

      --
      "Convictions are more dangerous enemies of truth than lies."
    91. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      That's all trivial: I still don't understand what he meant. Just that the code that was commented out will be two spaces to the right of the other code? (Who cares?)

    92. Re:Why put tabs in code anyway? by osu-neko · · Score: 1

      fewer keystrokes,

      Not really. The tab key still works, you understand, it just inserts the appropriate number of spaces.

      Yes, and then later when I go to edit the line, I have to hit the arrow key or delete key a bazillion times when I should have only needed to hit it once because some nimrod put twelve spaces where three tabs would have sufficed. The tab key works just fine, but the arrow keys, the delete key, and every other key on the keyboard is screwed, and you end up using MANY more keystrokes dealing with the godforsaken mess that was created...

      --
      "Convictions are more dangerous enemies of truth than lies."
    93. Re:Why put tabs in code anyway? by osu-neko · · Score: 1

      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.

      Been there, done that. Sounds like a nice theory, doesn't work in practice, since despite however much they might protest otherwise, space indenters are sloppy, and you will find that your trivial script is flummoxed by the fact that people who start by indenting for spaces for one level indent anywhere from seven to nine for two levels deep, ten to fourteen for three levels deep, etc, with increasing imprecision until you actually get overlap and it's not clear at what indent level code should be based on the number of spaces. Sure, you can figure it out, but it's not something that can be done with a trivial script.

      --
      "Convictions are more dangerous enemies of truth than lies."
    94. Re:Why put tabs in code anyway? by Haeleth · · Score: 1

      You seriously think we should give semantic meaning to colours and formatting? What possible advantage could that provide that would outweigh the massive and obvious disadvantages, such as the impact on blind programmers?

    95. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      So, for all those space fans, what is it about spaces that you find useful?

      For my part, I think my primary motivation for preferring spaces is a largely philosophical objection to the existence of a character that I can't frickin' see. (For the benefit of the incurably pedantic: in this context, by "see" I mean "distinguish from a series of spaces".)

      This of course has some practical consequences, such as it being impractical to ensure that you are using tabs consistently for indentation - which of course destroys the advantages of using tabs that you mentioned.

      Now, if I was using editor which uses tabs to represent indentation level and then displays that indentation level in a clear way, that would be a different matter. However, as per the original story, I'm using Visual Studio. :-)

      Quite apart from this, however, it isn't always convenient to bring up the development environment, whatever it might be, to look at a bit of code. I often want to quickly check something, and will type the code in a command window, or open it in notepad, or whatever the default editor happens to be on the computer I'm using at the time - and unless I'm using eight character indentation (which I find way too wide) code with tabs is not going to be very readable.

    96. Re:Why put tabs in code anyway? by Haeleth · · Score: 2, 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.

    97. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      When I want to dedent I can press del once, not four times.

      Dunno about you, but my editor has a single keystroke that will do that for me.

      With tab and the editor settings we can all get what we want.

      That's all very well ... but since a tab looks exactly like a series of spaces, how do you avoid accidentally putting in spaces for indentation and/or tabs for spacing? The answer may very well be "my editor shows me tabs" but heck, this story is about Visual Studio. :-)

      back in the time of computer dinosaurs some editors only knew how to render tab with 8 spaces

      You mean, like notepad? Or the type command? (It isn't always convenient to bring up a development environment when I need to quickly check on some code, and I'm not always working on my computer. I need to be able to use the tools that are always available.)

    98. Re:Why put tabs in code anyway? by osu-neko · · 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 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."
    99. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      Good in theory, but useless in practice unless you can actually see the difference between the tabs and an equivalent number of spaces. Otherwise some lines will have tabs, some will have spaces, and some will have a mixture. UG-ly.

      If you're using an editor that displays tabs, good for you. But this story is about Visual Studio.

    100. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      * 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.

      Alt+F8

    101. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      Well, on my editor (and I would have thought any development-oriented editor) removing a level of indentation is a single keypress. So are all of the things I do often when coding, regardless of whether the source has tabs or spaces ... except if there are tabs in the code things sometimes happen that I didn't expect, leading to extended cursing. :-)

      I'm not sure what you mean by saying that the arrow keys are screwed; I guess this depends on what you want them to do. For my part, what I especially don't want them to do is to depend on whether a particular line of source code has spaces or tabs, and in my experience trying to use all tabs doesn't work, so I prefer all spaces.

      (Actually, if it comes down to it, I always want left-arrow to move me one position to the left. If I want to go all the way to the left, I'll use control-left-arrow, or whatever keystroke maps to that in the particular editor I'm using. If I want to remove one or more levels of indentation, I'll use the keycode that does that.)

      It's becoming increasingly obvious that this stuff depends heavily on coding style, choice of editor, and most of all, What You're Used To. :-)

    102. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      I'm not talking about people insisting on using spaces, I don't understand how you avoid mixing tabs and spaces by accident ... seeing as how they look exactly the same.

    103. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      You're talking about different things - the keystrokes used to manipulate spaces may be different for different editors, but they'll be what the person used to using that editor expects which is what matters for editing.

      The problem with different editors interpreting tabs in different ways is that the code risks getting mangled as soon as it is moved from one editor to another.

      Also - from my point of view, the problem with tabs is that it is difficult to use them consistently. Surely you would prefer code that was all spaces than code that was a random mixture of tabs and spaces?

    104. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Now... If you were to use spaces instead of tabs, this problem would be entirely moot. Periodically search for tab, and replace with 2 spaces, across the whole codebase. SVN will happily report the files changed (that used to have tabs in), and you'll be able to identify which devs were responsible for the tabbed lines. Go over and slap them. Problem solved.

    105. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      OK, but why use tab? Why not a dot followed by whitespace, or a tilde, or, or, or ... or anything that is visible on a hard copy?

      I mean, seriously, what were they smoking?

    106. Re:Why put tabs in code anyway? by harryjohnston · · Score: 2, 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.)

    107. Re:Why put tabs in code anyway? by The_Noid · · Score: 1

      What you and parent want is elastic tabstops. That solves the problem of people that don't understand that tabs are for indentation and spaces for alignment. See http://nickgravgaard.com/elastictabstops/

      People are different and different people need different tab sizes to make the code optimally readable for them.

      Also, I've never had to search for a tab character, why are you searching for whitespace?

      If math or if constructs are so complex they become unreadable, they probably should be split up in multiple statements. That's much better for understanding what happens that trying to mess with the layout of that single statement.

    108. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      The one that annoys me the most is how using spaces utterly messes up cursor movement.

      Know thy test editor sir! Use the Ctrl key with cursor keys. We're not in the 70s anymore.....
       

      Replacing all those spaces with tabs, making the code much easier to maintain, is one of the things I always do before recommitting the code.

      1. With each commit you're making a tonne of SVN noise making it impossible to figure out if you accidentally checked in something you shouldn't have. You'd have a *lot* of explaining to do if I was your lead....

      2. How is 'well indented code using tabs' more maintainable than 'well indented code using spaces'? Attempting to argue that point will just make you look silly.

      3. I think you're confusing 'poorly formatted code' and 'code formatted with spaces'. I indent all of my code with 2 spaces. I can guarantee you that it does not need reformatting.

    109. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      If you are programming in a indentation sensitive language, then an accidental combination of spaces with a particular tab setting can completely change the meaning of:

              if condition1 then
                      if condition2 then ...
                      else ...

      Such languages exist and using tabs seems fragile to me if you are programming in them.

    110. Re:Why put tabs in code anyway? by IBBoard · · Score: 1

      That'd be the first point then - code cleanup in Eclipse replaces tabs with spaces as "correct indentation". VS.Net may still be behind in that area (I know MonoDevelop is), but mixing is an unavoidable possibility whether you prefer tabs or spaces unless you have IDE tools to automatically resolve it.

    111. Re:Why put tabs in code anyway? by alobar72 · · Score: 1

      Well it must not be color or such. But I think he has got a point here: The overall method of software development has not changed since... I dont know. ( ok, some new paradigms now and then ) Should there not have been a more significant evolution within the process of software development ?

    112. Re:Why put tabs in code anyway? by Hobart · · Score: 1

      I myself am pretty impartial, but here's a guess:

      Space fans find it convenient to be able to pop open a piece of code from seven different places, six of which don't have their personal preferences set (likely - 2-space indentation), and have the code render right each time.

      The default behavior of 8-spaces-per-tab in so many places makes it likely that something 4 layers deep will be shoved clear off the right edge of the window, or badly wordwrapped, wrecking the layout, but if tabs are thrown out altogether, the spaces-based indentation appears consistent and predictable, whether using Wordpad on a manager's machine to edit a file pulled via web out of version-control, using vi on a remote build VM that's being used to test different compiler settings, or your own tweaked-to-your-liking visual studio or GVim setup.

      --
      o/~ Join us now and share the software ...
    113. Re:Why put tabs in code anyway? by gazbo · · Score: 3, Informative

      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.

    114. Re:Why put tabs in code anyway? by _xeno_ · · Score: 1

      Simple: Turn on the option that makes tabs visible. At least, that's how I do it in Eclipse, I don't know if there's a similar option in Visual Studio, but I'd assume there is.

      Granted some people might find visual whitespace to be a bit annoying, but it does solve the problem of accidentally mixing tabs and spaces.

      --
      You are in a maze of twisty little relative jumps, all alike.
    115. Re:Why put tabs in code anyway? by mqduck · · Score: 2, Informative

      I see an ordered, numeric list. What are you seeing?

      --
      Property is theft.
    116. Re:Why put tabs in code anyway? by AaronLawrence · · Score: 1

      We had this debate at my work, and the conclusion I came to was that neither tabs nor spaces usefully allowed changing the tab-size. The reason is that code is often indented, not in whole tabs:

      if ( AThing )
          MyFunction( parameter1,
                                  parameter2 );

      Making this appear correct with a varying tab size requires using tabs to indent for block level, but spaces to indent for formatting. This is very tedious, but might be managable, except that the editors we mostly use (VS6 at the time) are not clever enough to remember that combination of indenting for the next line. So not only do you have to remember "tab space space space space space space" but you ALSO have to go back and delete the "tab tab tab tab space" that the IDE added for the next line, and instead type "space space space space space" again ...
      I tried it briefly, and it did work; but it was pretty maddening.
      I would be a bit surprised if there were many editors out there that were smart enough to copy the indenting in terms of combined tabs and spaces...

      Anyway, I accepted that we would use tabs to finish the useless argument, but we also agreed on a fixed tab size, so it was completely pointless either way ;)

      --
      For every expert, there is an equal and opposite expert. - Arthur C. Clarke
    117. Re:Why put tabs in code anyway? by _xeno_ · · Score: 1

      Or, if you're using Apple's Xcode, Command-[. Damn if that doesn't piss me off. Sure, it's consistent with the "standard" Apple keyboard shortcuts. But tab/shift-tab is simply easier to type and the way to do it in every other IDE I use.

      --
      You are in a maze of twisty little relative jumps, all alike.
    118. Re:Why put tabs in code anyway? by Blakey+Rat · · Score: 1

      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.

      Wha? How are ANY of those impossible with tabs?

      You *do* know you can put spaces after the last tab, right? So to align your comment /* comment, you just hit enter (let your editor auto-tab in), hit space twice, then you're on the same row. Amazing science fiction technology!

      As for the other two items, parameter names in a function declaration, arguments in a call... why can't you use tabs to align these? I thought I used tabs to do this every day, but I guess I was just hallucinating.

    119. Re:Why put tabs in code anyway? by Blakey+Rat · · Score: 0, Flamebait

      Well, your editor sucks. There's really no way around it.

      If you set Visual Studio (the editor we're talking about in this thread) into tabs mode, it'll *never* insert spaces. Not unless you hit the space bar.

      One of the things that bothers me is that if you set tab to use spaces, it becomes some weird special-case key, treated differently than every other key on the keyboard. If I type the key labeled "A", I get an "A" character in my document. If I type the key labeled "Space", I get a space character in my document. If I type the key labeled "Tab", I get a "Tab" character in my document. Why make things hard?

      (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.)

      Why would you *ever* view a code file from Notepad?

    120. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 1, Informative

      It doesn't have to be invisible so i don't know what you are complaining about.

    121. Re:Why put tabs in code anyway? by IBBoard · · Score: 1

      The solution there would be to either a) change your tab indent to something less than 5 or b) do something about your horrendous code to reduce all of the nesting (since it is only nesting, not code length that has changed).

      Don't blame the rendering for issues in your code complexity ;)

    122. Re:Why put tabs in code anyway? by GigaplexNZ · · Score: 1

      I still think it is easier to configure my shell than it is to convince a large number of programmers out there to do exactly what I want them to do.

    123. Re:Why put tabs in code anyway? by Linknoid · · Score: 1

      I used to indent parameters across multiple lines like that, but they're just too much of a hassle to maintain like that. I think it's just as readable and less work if you put each parameter on its own line, just give it normal indention:

      if (AThing)
      {
      --->MyFunction(
      ------->parameter1,
      ------->parameter2);
      }

      or normal indention + 1 indent:

      if (AThing)
      {
      --->MyFunction(
      ----------->parameter1,
      ----------->parameter2);
      }

    124. Re:Why put tabs in code anyway? by delinear · · Score: 1

      That's fine when you're working in isolation, but when you're working on code with a bunch of other people and some like two spaces, some four and some eight, your choices are either a) enforce your favoured formatting flavour (assuming you're at the top of the food chain this'll work, but you'll likely annoy some people into the bargain) or b) use tabs and everyone configures for their own viewing pleasure. I can't speak for everyone else, but I probably spend 70% of my team reading code to 30% writing it, so personally I'd be willing to slightly modify the way I write code if it meant efficiency gains (and fewer migraines) reading it - of course it only works if everyone adopts the practice which is generally where these things fall down.

    125. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Or whether to stick * and & to type name or to variable name in declarations.

      Never understood this one:

      int *inp, *outp;

      vs

      int* inp, outp;

      Both look like they're defining the same things, only one will actually work. How is this up for discussion?

    126. Re:Why put tabs in code anyway? by IBBoard · · Score: 1

      Know thy test editor sir! Use the Ctrl key with cursor keys. We're not in the 70s anymore.....

      Exactly, so why use spaces? ;)

      On a more serious note, that doesn't resolve issues with dropping a level of indent and moving up or down there. Ctrl+arrow would drop you to the start or end of the indent, not move you one level. Moving one level with spaces needs you to count (and to hope that "consistent use of spaces" is consistent).

      1. With each commit you're making a tonne of SVN noise making it impossible to figure out if you accidentally checked in something you shouldn't have. You'd have a *lot* of explaining to do if I was your lead....

      And the difference between that change (which is then flexible for anyone who wants any indent) and the people who have advocated spaces and said "well I just replace all of the spaces to meet my standard" is...? Whatever reason you're changing white-space for, you're making VCS noise.

      2. How is 'well indented code using tabs' more maintainable than 'well indented code using spaces'? Attempting to argue that point will just make you look silly.

      Tabs may be more maintainable between developers because of personal preferences, but beyond that I agree - indent method and maintainability aren't that closely linked.

      3. I think you're confusing 'poorly formatted code' and 'code formatted with spaces'. I indent all of my code with 2 spaces. I can guarantee you that it does not need reformatting.

      What if 2 spaces isn't a sufficient indent and I want 4? It needs reformatting. What if you're a space-indenter who also tries to align things (e.g. multi-line in-line array declarations) with their spaces rather than just indenting an extra layer and the length of a variable changes? It needs reformatting.

      The first of those isn't a problem with tabs, and the second is a problem with using spaces and wasting time getting character column perfect alignment.

    127. Re:Why put tabs in code anyway? by Bake · · Score: 1

      If you want to "see" tabs In Visual Studio 2008 it's Edit -> Advanced -> View White Space.

    128. Re:Why put tabs in code anyway? by delinear · · Score: 2, 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

    129. Re:Why put tabs in code anyway? by Peter+La+Casse · · Score: 1

      Spaces work better than tabs because the code is always formatted properly.

      No, because there is more than one way to properly format code, and different situations require different formatting. I sometimes edit the same code in a 24x80 terminal window and in an IDE maximized on a WUXGA screen. Sometimes the same code is edited by people with different levels of visual acuity.

      You cannot have your indent be two and me with 8 and have the code line up properly, especially when lining up complex if or math statements (where you may be using the level of indent to help with showing how the parens or operators nest).

      Sure you can. This comment shows how. I'm open to a counterexample though; can you provide an expression that cannot be made to render properly in a variable indentation width environment?

    130. Re:Why put tabs in code anyway? by delinear · · Score: 1

      Yes, his confusion is around the fact that he inserts two slash characters to comment the line and it no longer lines up with the surrounding code when we all know that the slashes should be added after the indentation rather than at the beginning of the line anyway, so that code will never line up (and if he insists on adding them at the beginning of the line, then using the insert key would have the desired effect in most systems).

    131. Re:Why put tabs in code anyway? by delinear · · Score: 1

      That's an argument for formatting guidelines, not against tabs, but you're right - this misuse does seem to be the reason most of the anti-tabbers are against their use.

    132. Re:Why put tabs in code anyway? by delinear · · Score: 1

      That seems like a specious argument to me - it's a reason to be extra careful in those circumstances, but on the wider scale (and even arguably in that instance if you are careful) it's no reason to endorse either method over the other.

    133. Re:Why put tabs in code anyway? by Graff · · Score: 1

      It seems to me that a lot of the problems of tab could be solved by making more than one kind of tab, encoding the tab width into the tab character itself.

      For example, create a tab-2, tab-3. tab-4. tab-5. tab-6. tab-7, tab-8, tab-9, tab-10. Now any text program has more information about formatting. It can display the tab as its default width as given in the tab character, ie: 2 spaces for tab-2, or it can convert the tab into the program's own method of formatting. This kind of system would be virtually invisible to the user and would allow programs to better use tabs and format text.

    134. Re:Why put tabs in code anyway? by GigaplexNZ · · Score: 1

      I guess I'm a fool then. I can't stand the comma being at the start of the line, I feel it should be at the end. Also, I think your attempts at formatting didn't work correctly, I'm guessing the comma should be in the same column as the curly brace but on my screen it isn't (off by one space).

    135. Re:Why put tabs in code anyway? by delinear · · Score: 1

      Tabs to indent, spaces to align, problem solved - everyone still gets their favourite indentation level and everything after the indentation still aligns nicely. What's so difficult about that that we'd sacrifice the usability of user-defined indentation spacing?

    136. Re:Why put tabs in code anyway? by mario_grgic · · Score: 1

      Your diff tool should have an option to ignore whitespace when computing diffs or else you will go insane.

      --
      As the island of our knowledge grows, so does the shore of our ignorance.
    137. Re:Why put tabs in code anyway? by ftobin · · Score: 1

      Frankly, from a logical perspective, I've never figured out what benefit spaces have over tabs...

      While I understand your argument for tab characters, I have moved to the opinion that given our current editor generation, printable characters only (e.g., spaces only) are the best option. Part of coding is the presentation: being able to relay your picture of the code to another has significant value. With control characters in the code, the presentation value can be lost. Using only printable characters eliminates this issue.

      The argument for control characters such as tabs really should be extended all the way to going XML-style, where the code is completely re-parsed and presented to the author in a completely different way from its underlying structure. This is a reasonable approach, but our current generation of editors (at least the ones I've been exposed to on linux) are not at that level yet.

    138. Re:Why put tabs in code anyway? by Lord+Kano · · Score: 1

      You sir, apparently missed the point of that statement.

      LK

      --
      "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
    139. Re:Why put tabs in code anyway? by Punto · · Score: 1

      the only reason to use spaces is to impose your indenting style on others. if "some lines have spaces", it's your fault for using spaces instead of tabs. stop it, and everyone will be happy.

      --

      --
      Stay tuned for some shock and awe coming right up after this messages!

    140. Re:Why put tabs in code anyway? by Blakey+Rat · · Score: 1

      I am staggered we are still writing text files for programming. Staggered. No colour, no bolding, no structure.

      Maybe you shouldn't be using the same editor you were in 1970.

      We're talking about Visual Studio in this thread, you know... it has color (although no "colour", being an American product), it has bolding (if you like, off by default), it has intelligent parsing of structure.

    141. Re:Why put tabs in code anyway? by Blakey+Rat · · Score: 1

      While I understand your argument for tab characters, I have moved to the opinion that given our current editor generation, printable characters only (e.g., spaces only) are the best option. Part of coding is the presentation: being able to relay your picture of the code to another has significant value. With control characters in the code, the presentation value can be lost. Using only printable characters eliminates this issue.

      I respect your opinion, but this explanation is so vague as to be utterly useless, which gives me the sense that you haven't really thought about the problem.

      What, specifically, prevents tabs from (and I quote) "being able to relay your picture of the code to another"? For that matter, what exactly is "the picture of the code"? I've never heard of that term before.

    142. Re:Why put tabs in code anyway? by ftobin · · Score: 1

      What, specifically, prevents tabs from (and I quote) "being able to relay your picture of the code to another"? For that matter, what exactly is "the picture of the code"? I've never heard of that term before.

      The "picture of the code" includes everything with the textual layout of the code, everything visual. Tabs, being non-printable characters, can be rendered in different ways from the author's intention, creating the potential for loss in transferable meaning. Tabs have semantics of "increase the indent level", while spaces are non-semantic pixels that the author is, in a sense, "painting code". How well the author "paints" adds or reduces value.

    143. Re:Why put tabs in code anyway? by siride · · Score: 1

      Neither has writing English or speaking, but I daresay that's a problem. Sometimes, things just work and there's no need to go changing them.

    144. Re:Why put tabs in code anyway? by Blakey+Rat · · Score: 1

      The "picture of the code" includes everything with the textual layout of the code, everything visual. Tabs, being non-printable characters, can be rendered in different ways from the author's intention, creating the potential for loss in transferable meaning. Tabs have semantics of "increase the indent level", while spaces are non-semantic pixels that the author is, in a sense, "painting code". How well the author "paints" adds or reduces value.

      That reply is still far too vague. I honestly still have no clue what you're talking about from a practical perspective... please give me an example of what can be lost. A practical example, something I can really bite into.

    145. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Not that I'm a fan of spaces, but most source code that I've seen tends to align things other than the beginning of the line, which makes changing the tabstop-width screw up the layout for everything but the beginnings of lines (and often also screws up the beginnings of lines because of stupid editors).

      I'm more interested in the indentation being consistent rather than according to particular preferences, which is why separate settings for tab width (which has been de-facto fixed at 8 for ASCII for quite some time now) and shift width for indentation is nice, as the layout will look the same for different people without needing to fiddle with settings.

    146. Re:Why put tabs in code anyway? by shutdown+-p+now · · Score: 1

      Just because some languages made a poor style decision, doesn't mean that we should all suffer. That cascading function definition is awful, keep it on one line.

      It's not about function definitions in Haskell. It's things like this:

      let x = 1
          y = 2
      ...

      Here is a more detailed description of rules and conventions. F# is quite similar.

    147. Re:Why put tabs in code anyway? by alobar72 · · Score: 1

      ok, might be a point. But I see a major difference here:
      speaking and writing english takes place between communication partners that are more or less compatible regarding hardware ( methods of perception, etc ) and software ( cultural Background, social concepts ) and so on.
      The interaction between computers and men is somehow different.
      see, we took a method of communication that is very close to the one we use to communicate with each other ( more or less english ) and are using it to communicate with a machine that is by no means similar to us.
      Ok, we made those machines "understand" the english-like texts we enter - but still I tend to believe, that if two completely different partners want to communicate, the most efficient way will not be a method that is more or less identical to the method that one of the partners is using to communicate with his own kind.
      But on the other hand; who knows :-)

    148. Re:Why put tabs in code anyway? by siride · · Score: 1

      That's not at all related to the analogy I drew. The point is simply that there are plenty of systems that we have developed that have become more or less static because they continue to fulfill the needs of the users of the system. In other words, if it ain't broke, don't fix it. Why add colors and other weird things when text will suffice? Nothing has yet come along that can compete with plain text for writing programs. It is flexible, simple to parse by both humans and computers and works everywhere (across different software, different architectures, even on paper or spoken aloud).

    149. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Preview works.

    150. Re:Why put tabs in code anyway? by shutdown+-p+now · · Score: 1

      You *do* know you can put spaces after the last tab, right? So to align your comment /* comment, you just hit enter (let your editor auto-tab in), hit space twice, then you're on the same row. Amazing science fiction technology!

      Even more style guidelines frown upon mixing tabs & spaces than just tabs alone. Some languages with significant indentation forbid this kind of thing outright because of the high possibility of mistake (e.g. F#).

      As for the other two items, parameter names in a function declaration, arguments in a call... why can't you use tabs to align these? I thought I used tabs to do this every day, but I guess I was just hallucinating.

      It all depends on how you do it. I usually do it like this:

      void foo(
          int bar,
          int baz);

      which is obviously quite doable with tabs. But I've also seen it done like this:

      void foo(int bar,
              int baz);

      which would require mixing tabs & spaces.

    151. Re:Why put tabs in code anyway? by shutdown+-p+now · · Score: 1

      It's precisely for that reason that most C++ (not C) coding style guidelines recommend against declaring several variables on one line. So it really ends up being:

      int *p;

      vs

      int* p

      which is less clear-cut. Sticking * to the left can be seen as more natural as it's part of the type, and so should be grouped with it. From language grammar POV, of course, there is no quesion - it belongs to the variable name.

    152. Re:Why put tabs in code anyway? by Blakey+Rat · · Score: 1

      Even more style guidelines frown upon mixing tabs & spaces than just tabs alone.

      Well, yah, I understand that.

      But in this case, you're not "mixing" them by any normal definition of the term-- you're using tabs to set the correct tab-level, then using spaces to pad to where you want the cursor. It's not like you hit Tab-Space-Space-Tab-Tab... that would be crazy and obviously wrong. (Plus, with how tabs work, it wouldn't work right anyway.)

      Then again, why do you need to line up the text in the first place? Why not just put the open comment on a different line, which is what I often do. Or simply let the second line be two spaces further in than the first, that's not going to crack open the sky and bring disaster to us all.

      It all depends on how you do it. I usually do it like this:

      Yeah, well the point is that all of those things can be done perfectly well using only tabs, making the argument completely invalid.

    153. Re:Why put tabs in code anyway? by shutdown+-p+now · · Score: 1

      Then again, why do you need to line up the text in the first place? Why not just put the open comment on a different line, which is what I often do. Or simply let the second line be two spaces further in than the first, that's not going to crack open the sky and bring disaster to us all.

      There are existing conventions in place (meaning, everyone else already does it that way) for some languages out there which require lining things up. Have a look.

      Yes, for C/C++/C#/Java, I normally only indent lines at start, which does not preclude tabs.

    154. Re:Why put tabs in code anyway? by thePowerOfGrayskull · · Score: 1

      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.

      But that doesn't justify needing to do it... especially when you can use a tab character in the first place, rendering this an unnecessary step. The biggest reason I prefer tabs is that it lets everyone use their own indentation size, without needing to reformat (and generate a lot of diff noise) every time they check in.

    155. Re:Why put tabs in code anyway? by Agronomist+Cowherd · · Score: 1

      I agree with the other commenter. It is awful.

      Not because it isn't all on one line, that would be worse.

      But because of the leading commas (noted by the other commenter as an abomination) and because the indentation varies by the length of the type name. An appropriate way to deal with potentially long lists is to end the line with the open delimiter (curly brace in this example), and then indent each item by a standard amount; finish with the closing delimiter on a line of its own indented to match the outer line.

      I'm not going to fight with Slashdot's lame input field/text parsing, so here is an example with leading underscores:
      data User = User {
      __login_id :: LoginId,
      __login_password :: Password,
      __first_name :: Maybe FirstName,
      __last_name :: Maybe LastName,
      __email_address :: Maybe EmailAddre,
      __user_permissions :: [ Permission ]
      } deriving (Data, Eq, Ord, Show, Typeable)

      --
      -DwS
    156. Re:Why put tabs in code anyway? by Agronomist+Cowherd · · Score: 1

      One of the things that bothers me is that if you set tab to use spaces, it becomes some weird special-case key, treated differently than every other key on the keyboard. If I type the key labeled "A", I get an "A" character in my document. If I type the key labeled "Space", I get a space character in my document. If I type the key labeled "Tab", I get a "Tab" character in my document. Why make things hard?

      Really? What do you get when you push the key labeled Delete? Or the one labeled Shift? Or the one labeled -> (cursor right)? I think you've got lots of keys that don't insert what they're labelled as.

      Putz.

      --
      -DwS
    157. Re:Why put tabs in code anyway? by ratboy666 · · Score: 1

      Simply put, "tab" doesn't work...

      doublea;
      intb;

      should render as (LEADING indent removed)

      double..a;
      int.....b;

      Note - the a and b are aligned. Assuming 8 space tab expansion. Now, let's see a 3 character expansion.

      double...a;
      int...b;

      Notice that a and b are no longer aligned -- even with a stinkin' monospace font!

      And, what about the edge case - ? Can a space be tabbed? I sure hope so. Witness the expansion.

      int.a, ....b;

      To maintain this over indent levels means that spaces should be tabbed.

      Now, the solution is simple - tab control separate from source. This would allow me to say

      inta,
      b;

      which is what I am really trying to express. Notice the clear distinction between "indent" and "tab" here. What we then need is some format definition associated with the source - might as well go with proportional fonts and bold/italic as well.

      But, as long as we only have AND it can be redefined (in some cases, its worse - I've had to deal with an editor that only allowed to be expressed as the next PIXEL boundary to move to. eg. tab=10 meant go to the next even 10 pixels), I'll stick with spaces, m'ok'thanx.

      --
      Just another "Cubible(sic) Joe" 2 17 3061
    158. Re:Why put tabs in code anyway? by ratboy666 · · Score: 1

      Oops, f'n thing ate my homework

      try this

      [clear tabs][indent]int[space][define tab]a,
      [tab]b;

      instead

      I hope this clarifies wtf I'm talking about.

      --
      Just another "Cubible(sic) Joe" 2 17 3061
    159. Re:Why put tabs in code anyway? by marcosdumay · · Score: 1

      I agree that giving (different) meaning to invisible characters is bad, but I must point that "\0", "\000" and "\x00" are exactly the same character (also, '0' if you happen to be coding in C). No wonder that most compilers treat them the same way.

    160. Re:Why put tabs in code anyway? by marcosdumay · · Score: 1

      You never have to worry about half indents choking the editor.

      I don't understand what you mean by this.

      If you use 4 spaces identing, and somebody uses 2 spaces identing on your team, your editor will only be able to ident things at the even levels of the other person's code.

    161. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      I find it easier to avoid putting any tabs into a document than to avoid putting any spaces in, particularly if the tab key is mapped to another function. :-)

      Naturally enough, it depends on your development environment.

      (Did you mean that Eclipse would replace spaces with tabs? Isn't that what you wanted?)

    162. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      Huh. If I'm commenting out code, I want it to be indented differently to the code that's still active, so I can easily tell the difference. Oh, well, po-TAY-to po-TAH-to, I suppose.

    163. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      My experience with Visual Studio in tabs mode was that spaces still wound up in the indentation. Perhaps I was hitting spacebar sometimes to indent ... there are some disadvantages to being a touch typist ... or perhaps the spaces were originally between tokens that got removed ... I don't know. It just didn't work for me.

      Why would I view a code file from Notepad? Sometimes I'm just in a hurry and don't want to wait for VS to initialize. Sometimes I'm using a computer on which VS is not installed. Sometimes it's just habit; my fingers can type "notepad" without requiring input from my brain.

    164. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      Bugger. I had a feeling someone was going to know how to make Visual Studio show tabs. :-)

      On the whole, I think my own preference is still to stick with spaces; they work for me. But, OK, if I had to use tabs, I guess I could.

    165. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      stop it, and everyone will be happy.

      How? I don't put the darn things there on purpose, they just show up. And if I can't see them, I can't remove them.

    166. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      The comma at the beginning makes the lines rearrangeable without requiring a trailing comma. I agree it looks weird, though.

    167. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      Thanks.

    168. Re:Why put tabs in code anyway? by poopdeville · · Score: 1

      The solution there would be to either a) change your tab indent to something less than 5 or b) do something about your horrendous code to reduce all of the nesting (since it is only nesting, not code length that has changed).

      You missed the point, and so your solution is utterly broken. In particular, in this hypothetical example, I downloaded code that I now cannot read without text munging or changing my preferences.

      Are you seriously suggesting that I should change my hypothetical preference for 5 space tabs because 2-space tab documents might not render correctly? That entirely undermines the idea that using tabs is preferable because it lets everybody pick their own indentation. It doesn't. That was my point.

      --
      After all, I am strangely colored.
    169. Re:Why put tabs in code anyway? by poopdeville · · Score: 1

      ... and because the indentation varies by the length of the type name.

      And that's bad because...? I presume it's because it makes it easy to distinguish between types and values. Procedural programmers tend to obscure things for pay raises.

      You're going out of your way to hide the code's tabular form. Every program you write is a state machine. Why hide it? You only complicate life for yourself.

      I'm not going to fight with Slashdot's lame input field/text parsing, so here is an example with leading underscores:

      Yes, that's very ugly. My version makes it extremely clear that we're defining a type. Yours looks like a block of random C code (maybe with extensions). Look at how the text crowds around the keywords and names.

      --
      After all, I am strangely colored.
    170. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      For example, create a tab-2, tab-3. tab-4. tab-5. tab-6. tab-7, tab-8, tab-9, tab-10.

      Thus we defeat the purpose of tab.

    171. Re:Why put tabs in code anyway? by MikeFM · · Score: 1

      We all have to use Windows some times.

      --
      At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
    172. Re:Why put tabs in code anyway? by MikeFM · · Score: 1

      You want your indention to match for every line of code in a block of a certain depth don't you? How else do you tell you haven't put the line in the wrong place without having to trace the logic? Maybe it isn't important if you're working on a 100 lines of code but if you're working on 50,000+ lines of code neatness matters.

      --
      At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
    173. Re:Why put tabs in code anyway? by Graff · · Score: 1

      Thus we defeat the purpose of tab.

      No, the purpose of the tab would still be there. The width would be a formatting suggestion to the application. Depending on the application and the user preferences the tab could be treated as either the width encoded in the type of tab or used as the old-style tab.

      More information is usually better, at worst you just treat every type of tab as if they were all the same. This is a simple way for applications to pass information about spacing without having to use multiple space characters or some sort of complicated meta-data system.

    174. Re:Why put tabs in code anyway? by smellotron · · Score: 1

      I didn't mean to imply that "\x00", "\000", and "\0" were distinct from each other... I just meant that all languages allow us to specify nonprintable characters using escape sequences, rather than, for example, having to embed literal null characters or carriage returns into a string.

    175. Re:Why put tabs in code anyway? by bit01 · · Score: 1

      It should be noted that at least half of the arguments you make are exactly identical to arguments I always make, save that they're arguments for using tabs instead of spaces.

      Please explain.

      The one that annoys me the most is how using spaces utterly messes up cursor movement.

      Up/down/left/right arrow keys work just fine. With tab characters it's anybody's guess where the cursor will end up. Tab/backtab keys work just fine.

      Ugh. Fixing the problem should be easy, but it's frequently a pain, as a quick find/replace macro to restore sanity to the file

      Tab characters are not sane, they're a primitive hack. They don't handle indentation correctly. They don't handle formatting correctly. They don't handle any damn thing correctly.

      all I know is whenever I find extraordinarily sloppy indenting, sure enough, it's the product of one of those sloppy space-indenters.

      Not my experience. Tab character use is a mess, frequently replacing tabs with spaces and vice versa. Depending on the editor often with no visual indication about which is being used. And spaces between tab characters as a bonus. Thus making the "editor adjust indentation to suit me" silliness even more irritating. Tab characters don't work properly inside comments, including commented code, don't work well when aligning multiple line statements and tabular code and don't work well when you're doing global variable/code name changes. If a programmer can't easily work with whatever the coding standard indentation is, from 1 to 8 spaces, then they should go back to school. They're even worse than the programmers who know only one language. You're right that some programmers aren't careful about maintaining the correct indentation however programmers who use tab characters are even worse because they have another entire group of mistakes they can and do make.

      Replacing all those spaces with tabs, making the code much easier to maintain, is one of the things I always do before recommitting the code.

      Tab characters very definitely do not make code easier to maintain, if for no other reason they make ambiguous the physical layout and character representation of the code. Spaces are unambiguous.

      ---

      DRM. You don't control it means you don't own it.

    176. Re:Why put tabs in code anyway? by d3matt · · Score: 1

      Good to know... I could've sworn that one of the older tutorials used to recommend tabs over spaces.

      --
      I am d3matt
    177. Re:Why put tabs in code anyway? by bit01 · · Score: 1

      What you and parent want is elastic tabstops.

      A nice idea however nobody is using them, tab characters are not needed and they don't give enough control. I often break naive tab stop rules to allow better positioning of code or comments on the screen.

      People are different and different people need different tab sizes to make the code optimally readable for them.

      Any programmer who can't easily cope with any indention between 1 and 8, in other words whatever the the project coding standard is, is not competent.

      Also, I've never had to search for a tab character, why are you searching for whitespace?

      It's frequently used to search for the start or end of a word eg. " getBlah", avoiding "forgetBlah", or to search for the word at a start of a line with a regular expression e.g. "^ *the".

      If math or if constructs are so complex they become unreadable, they probably should be split up in multiple statements. That's much better for understanding what happens that trying to mess with the layout of that single statement.

      No, it's frequently much easier to read in a single statement. e.g. 2D matrix algebra, such as in graphics, can be formatted in a 2D grid that's much easier to visualize than something with intermediate temporary variable names that are immediately discarded. Less error prone too. Another example is 2D tabular data to initialize an array of records.

      ---

      Every new patent is a new law; another opportunity for a lawyer to make money at the expense of the wider community.

    178. Re:Why put tabs in code anyway? by bit01 · · Score: 1

      Slashdot is messing up my formatting.

      --tuple = (x,
      -- y,
      -- z);

      The x,y,z line up vertically. Should there be a tab character after the --?

      a_long_named_variable_x =
      a_long_expression_that_that_is_similar_to_another_expression_x;
      a_long_named_variable_y =
      a_long_expression_that_that_is_similar_to_another_expression_y;
      a_long_named_variable_z =
      a_long_expression_that_that_is_similar_to_another_expression_z;

      The variables are indented 8 spaces and the expressions indented 4 spaces. The expressions are too long to fit on the right of the "=" but they are very similar and lining them up makes that similarity clear, even though it breaks naive indentation rules.

      ---

      Monopolies = Industrial feudalism

    179. Re:Why put tabs in code anyway? by mrboyd · · Score: 1

      but my editor has a single keystroke...

      then

      (It isn't always convenient to bring up a development environment...

      My point exactly! THANK YOU :)

    180. Re:Why put tabs in code anyway? by harryjohnston · · Score: 1

      Ingenious cutting, but it doesn't really hide the obvious: bringing up a development environment to look at code is often inconvenient, but you would not expect to edit code outside of your development environment on a regular basis.

      On the rare occasion where this is necessary, pushing delete a few extra times hardly seems onerous.

    181. Re:Why put tabs in code anyway? by IBBoard · · Score: 1

      And you missed the point as well, so your solution is utterly broken ;)

      What if I downloaded code that used 8 spaces instead of tabs? Then I have no control over the indent depth whatsoever and so I have no choice but to keep scrolling horizontally. IMO that completely undermines the idea that using spaces is preferable, since different monitors resolutions and font sizes can make readable code unreadable.

    182. Re:Why put tabs in code anyway? by IBBoard · · Score: 1

      I can't avoid putting spaces in documents, but I put them in where they help clarity (e.g. between the variable, the equals and the value) and generally let the IDE's auto-format sort out the tabs (unless I'm working in a text editor like gEdit or Geany, at which point it is tabs at the start then spaces in the middle).

      Naturally enough, it depends on your development environment.

      True, which is why I find it kind of funny that some people get so irate over using tabs. Spaces are usable if you must, but I find tabs more flexible and easier to work with, especially in an IDE but also in a text editor and the console. Half of the space-users seem to go ballistic at the idea of tabs!

      (Did you mean that Eclipse would replace spaces with tabs? Isn't that what you wanted?)

      Yeah, Eclipse can auto-format to replace spaces at the start of a line with correct tab-based indentation (and probably the other way around if you set it, but I've not looked). It is what I wanted, and it solves the "what if you end up with a mix" problem. I just wish that more IDEs (like the two main .Net ones) supported it.

    183. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      using tabs enables cheating. if your code gets too complex and functions too big, you just lower the tab size, ie from 8 to 4, from 4 to 2...
      when using spaces, you will see pretty soon, when code is a big mess, and you cant cheat with spaces...

      btw, your point 2 is not valid. if someone changes indenting - the mess is there, using whatever you like. when tab-user edits spaced code or vice versa, and he is too lazy to reformat the code, then there will be mess anyway.

      points 4 and 5 are same and do not make much sense...

      so 1 and 3 are left only, where 1 is rarely used

      and then, 3 is for printing code. but c'mon, how often people really, really print their code out?

      well, so it seems, you dont have actually any arguments...

    184. Re:Why put tabs in code anyway? by The_Noid · · Score: 1

      Any programmer who can't easily cope with any indention between 1 and 8, in other words whatever the the project coding standard is, is not competent.

      Yes, and someone who can't speak normally is stupid...
      Sorry dude, but with that once sentence you just proven yourself to be very short-sighted and lost all your credibility.

    185. Re:Why put tabs in code anyway? by bit01 · · Score: 1

      Yes, and someone who can't speak normally is stupid...

      It has nothing to do with people with disabilities. Those are special cases and require special measures. Just like Hawking has his speech box. He would not be a competent physicist without some means of communication.

      Sorry dude, but with that once sentence you just proven yourself to be very short-sighted and lost all your credibility.

      It's called adhering to standards. If a programmer can't easily cope with standards as simple as basic indentation rules they're going to have no hope of adhering to more subtle coding standards like variable naming, modularisation and calling conventions.

      ---

      "Advertising supported" just means you're paying twice over, once in time to watch/avoid the ad and twice in the increased price of the product to pay for the ad.

    186. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Look at it with JavaScript disabled; it shouldn't matter, but it does.

      - T

    187. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      I'm seeing a gang of viscous ducks violently ripping apart a poor defenceless liger in the middle of a snowstorm.

    188. Re:Why put tabs in code anyway? by mqduck · · Score: 1

      I just did. I still see the same thing.

      --
      Property is theft.
    189. Re:Why put tabs in code anyway? by Anonymous Coward · · Score: 0

      Hmmm, I see what appears to be an oddly styled unordered list. My JS is always disabled, but I also always view in "classic discussion system", so maybe that's it. Or maybe ACs don't get served the same CSS and/or JS. I've previously noticed that before posting, ordered lists appear as expected, while submitted posts appear as if they were unordered. There are a few other differences in appearance between previewed and submitted posts (quoted text looks strange in preview), but this is the only one I've noticed which affects content, inasmuch as sequential numbering is "content".

      - T

    190. Re:Why put tabs in code anyway? by Peter+La+Casse · · Score: 1

      Sorry for the late reply.

      --tuple = (x,
      -- y,
      -- z);

      Put the x on its own line, like this:

      --tuple =(
      --- x,
      --- y,
      --- z);

      Now the x, y and z line up.

      a_long_named_variable_x =
      a_long_expression_that_that_is_similar_to_another_expression_x;

      Start the long expression on the line after the variable, indenting one additional level from that which the variable is indented at. If you break up the long expression onto multiple lines, indent them the same as the first line of the long expression, unless you want to add more for clarity of sub-expressions. The resulting paragraph of code will still resemble the similar paragraphs y and z.

      Or, keep the long expression on a single line and let the editor's word wrap handle it.

  7. This is bad by mysidia · · Score: 1, Flamebait

    It's an example of Microsoft imposing a policy decision on users of the software. Some of them don't want this, but they're going to be forced to do it this way because Microsoft is defining a tab policy

    The problem with this is.... old code, created with different settings in VS 2008 or earlier.

    And the need to be able to open it in VS 2010 and actually make sense out of it.

    E.g. backwards compatibility.

    Also, configurability of tab width and indent width is probably a good thing.

    If the other editors can't config tab width, they suck.

    Obviously companies and developers using the software should have coding standards that specify what tab width and indent width to use (normally 4 spaces)

    But still, regardless of software used, the number of spaces to use for a tab is a policy thing, that should be dictated by the developer(s) or their company.

    1. Re:This is bad by MichaelSmith · · Score: 1

      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.

    2. Re:This is bad by Anonymous Coward · · Score: 0

      None of your rant has anything to do with the article. VS still allows you to configure the number of spaces to use for a tab. The issue here is that there is no UI way anymore to set an indent size different from the tab size, an unusual (but apparently not unheard-of) requirement. However, in that bug, the Microsoft PM also posted the source code required to configure it separately. Which, considering Visual Studio is a developer tool, isn't all that unreasonable.

    3. Re:This is bad by scdeimos · · Score: 1

      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.

    4. Re:This is bad by harryjohnston · · Score: 1

      It's relevant to TFA. If you don't use tabs, the tab spacing doesn't matter, so the change in question is harmless.

      It's also very interesting to note that almost all of the arguments in favour of using tabs only work if the indentation level and the tab size are the same. Score one for Microsoft. :-)

  8. Anyone, anyone? by Blakey+Rat · · 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?

    1. Re:Anyone, anyone? by Anonymous Coward · · Score: 0

      Drinks, anyone?

    2. Re:Anyone, anyone? by Anonymous Coward · · Score: 0

      You misspelled ne1.

    3. Re:Anyone, anyone? by Anonymous Coward · · Score: 0

      I dunno... Bueller?

  9. close to dropping /. by MarkvW · · Score: 1

    Tabs are news?

    Have you no sense of responsibility to your audience?

  10. What's that old saw? by liquiddark · · Score: 3, Insightful

    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).

    1. Re:What's that old saw? by cstec · · Score: 1

      when it comes to complex, interesting questions of language design, very few people are even vaguely qualified to comment

      Fortunately, it's easy to identify those that shouldn't be commenting, since they're the only ones claiming to be qualified.

    2. Re:What's that old saw? by grepya · · Score: 1

      That old saw is the bike-shed effect: http://en.wikipedia.org/wiki/Bike_shed

    3. Re:What's that old saw? by Anonymous Coward · · Score: 0

      That's called bikeshed problem or in other words Parkinson's Law of Triviality

    4. Re:What's that old saw? by Zelig · · Score: 1

      BIKE SHED.

      http://bikeshed.com/

      That's what you're remembering.

    5. Re:What's that old saw? by oasisbob · · Score: 1

      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

      Ahhh! The old bikeshed metaphor! I've been using this one a lot as a web developer...

      Some people have commented that the amount of noise generated by a change is inversely proportional to the complexity of the change.

      I think the bikeshed should be white

  11. Foredecker is learning... by symbolset · · 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 will she choose to spend more time with her family? Is September a solid date for WinMo7, and even then how do you expect phone vendors to personalize their experience and ship product for Christmas?

    Frankly I think two team reboots in the last year means you've got nuthin' for Christmas '10, and Christmas '11 is looking like less than even money. That's a long time for iSlates and Android tablets to be walking all over you. Of course I've got it being any good at 30:1 against.

    And what about Ballmer? Is an off 40% decade while Apple grew 7x and Google grew 4x not enough evidence that he's not getting it done? You would figure with all of the leverage and cash he's got he could do better if he was any good. Hell, I think I could do better than that even if I gave half the gross profits away to get some global love. With the money Ballmer has wasted on obvious dead ends over the last decade we could buy each Haitian refugee his own quake-proof palace.

    --
    Help stamp out iliturcy.
    1. Re:Foredecker is learning... by Toonol · · Score: 3, Insightful

      I think you may be verging on the insane.

    2. Re:Foredecker is learning... by symbolset · · Score: 1

      You could be right. If I were sure you were wrong, then you would be right.

      --
      Help stamp out iliturcy.
    3. Re:Foredecker is learning... by Anonymous Coward · · Score: 0

      I think im vergin on the insane after reading that. Im so confused!

    4. Re:Foredecker is learning... by StuartHankins · · Score: 1

      Mod parent up. Foredecker is astroturfing on behalf of Microsoft, a poor effort at best.

    5. Re:Foredecker is learning... by Foredecker · · Score: 1

      Well, to be honest - the whole WinMO thing is a huge bummer for me. That's one reason I bought a gaggle of iPhones for my family. I was tired of waiting for a mobile OS that didn't suck.

      So, I don't have any insider knowledge on the WinMO stuff, but do know a couple things:

      1. Some really good people moved to the WinMO org lately.
      2. We get stuff right eventually. Im optimistic that the new team will deliver something credible.

      The problem is this I think: WinMO 7.0 could be awesome and sill not be successful in the mobile space in any material way becuase the market has gotten locked in to two other very good solutions (iPhone, Android). Just like we have a lock on the desktop and office space with Windows and Office.

      Its hard to comment on the iSlate/Pad/thing. There is TON of speculation about it and any tangible facts. Ill wait until Jobs launches it to form an opinion.

      Note, you wont find harsh criticism of Apple from me - they are a great company. See this blog post and its comments. Apple is not big enough to do search They needMicrosoft/a>.

      RRegarding Ballmer - I think you are being hard on him. One problem I have with many Microsoft critics is they expect Microsoft to be perfect. Kind of like your comment "Hey! Look Ballmer isnt perfect HAHAHAHA." You see this kind of thing all the time here on Slashdot.

      I love the repeated reference to Ballmer throwing a chair. Its like the lamest thing ever to keep brining up. Really... its lame. I think it probably happened. Maybe he didnt throw it, but something with a char likely happened. Many CEOs are famously pasionate. Jobs is quite the tyrant. How about Larry Ellison? He has an ego the size of the Death Star. Ill tell you this - Ballmer is a much better leader than Gates. Gates is a brilliant strategist, but Ballmer has corporate leadership skills in spades. Hes also good at growing skilled execs.

      As an aside, the exec to watch at Microsoft isnt Stephen Sinofsky (who is pretty good), is Qi Lu/a>. Ive heard him speak at internal meeting severl times now. He is the single most impressive executive Ive ever seen. I think he is the next Bill.

      YYes, we have failed products, we also have products that are profitable, but dont reach the level of expectations we set for it. I think the tablet is a great example. Our tablet stuff has some great features. For example, the handwriting recognition is stellar - it really is. But we didnt change the rest of the experience to match - it is still the normal desktop experience. I suspect apple will nail this.

      What people forget is despite the lack of market dominating success as Bill predicted, the Windows tablet PC has been a success. If any other company had done it they would be declared fabulous. The proof is in the pudding - our partners still make them and sell them. Believe me, they wouldnt do this if they didnt make money. The OEMs cut stuff faster than you can blink when it isnt successful.

      Yes, we have failed products and Ballmer makes bad decisions form time to time. But, I’m not sure what point that makes. So do all big companies, including Apple, Google, HP, IBM and many others. Apple tried for years with hand held computing things. Remember the Newton? They have had other bombs too like the Cube, the Motorola Rokr, the Pippin (game console), EWorld, Apple PowerCD, Apple Powered Speakers, How about Apple TV? Is that a failure or is the Jury still out on that? Have you used it? Its pretty lame. XBOX live is way/em> better – and has way more content. They also failed utterly in the productivity software market – remember Claris Works?

      I do ask you to consider that Microsoft has the financial, corporate, cultural fortitude to stick with things that need to be strategically successful. We m

      --
      Jibe!
    6. Re:Foredecker is learning... by Foredecker · · Score: 1

      How do you figure? See my repsonse and feel free to mak a cogent reply.

      --
      Jibe!
  12. Not just Microsoft... by Angst+Badger · · Score: 1

    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...

    --
    Proud member of the Weirdo-American community.
  13. Windows 7 still sucks but just not as much. by MikeFM · · Score: 1

    Do they count all of us who bought computers with Windows 7 pre-installed and then deleted it? Sure people rushed to Windows 7 - it's been a while since anyone running a PC could buy it with an OS that wasn't total crap so they could all finally get the updates they wanted. Windows PCs tend to be cheaper than Macs. Saying they outsell Macs is like saying they sell more Ford Focus's than BMW's. A PC does what a Mac does for half the price. It just doesn't look as good, work quite as well, last as long, or offer the same smug bragging rights. And of course you can get a juiced up PC just like same people will take a Ford Focus and soup it up. Why I dunno but I guess some people enjoy the challenge or are just smoking to much crack.

    --
    At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
    1. Re:Windows 7 still sucks but just not as much. by MightyMartian · · Score: 1

      Do they count all of us who bought computers with Windows 7 pre-installed and then deleted it?

      On one hand, sure.

      --
      The world's burning. Moped Jesus spotted on I50. Details at 11.
    2. Re:Windows 7 still sucks but just not as much. by Anonymous Coward · · Score: 0

      True. A lot of people keep a Windows partition around in case they ever want to boot into it to play some game or whatever. Doesn't tend to get used much, though.

    3. Re:Windows 7 still sucks but just not as much. by Anonymous Coward · · Score: 0

      bad analogy dude, if i remember correctly, in the UK at least, the BMW 5 series outsells the ford mondeao (which in terms of size and position in the model range is roughly the same)

    4. Re:Windows 7 still sucks but just not as much. by plague3106 · · Score: 1

      I know quite a few BMW owners; they aren't the model of reliablity you're pretending they are. There's even a known problem where the power window motors burn out, which had persitsed across several model years. Not fun when your window won't roll back up when its raining. They may have fixed it by now... but they have other issues as well.

    5. Re:Windows 7 still sucks but just not as much. by Anonymous Coward · · Score: 0

      Hi ! You seem like a moron. Let me help you out. Here is the gist: Vista *also* came pre-installed. Win7 is being adopted at a much higher rate. That was the point of the article. It was also in the heading. Try to read, it can help.

      If you wanted to make any relevant point at all, you could have looked up the PC sales figures to see if that explained the adoption rate. IMO, it wont. Its because people are actually going out and buying the damn thing because .. Heres a shocker for F/OSS cheerleaders.. THEY WANT AND PREFER IT OVER ALL THE COMPETING PRODUCTS THAT THEY KNOW OF.

    6. Re:Windows 7 still sucks but just not as much. by MikeFM · · Score: 1

      And my iMac crashes sometimes (bad RAM? Not often enough that I've checked.). My wife's first iPod Touch was exchanged because the battery would die after about half an hour. It's just an example and obviously while somethings may in general be better than others it isn't always the case. I'm sure the odd BMW sucks ass as does the odd Apple product. Still I've been using computers for decades ranging from expensive mainframe and Unix servers to the old TI and C64 to embedded controllers to modern Linux, Mac, and Windows systems. Linux is my choice for servers, Mac for desktop, iPhone OS for mobile, and Windows is good for people that want to run Windows software. To be fair Windows isn't my choice for anything but does a reasonable job of doing a little of everything. Windows 2000 is still my favorite Windows.

      --
      At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
  14. Tabs suck. Use a space. by MikeFM · · Score: 1

    Or you can intent with a single space and your code will be clear and easy to read instead of quickly rolling off the end of my 30" monitor. I should never have to scroll horizontally when reading code. Of course some dipshits think the entire program should be on one line. Who uses a crappy editor that doesn't adjust formatting to match your preferences? The tab character has the semantic meaning of jumping to a random spot in the middle of the page with the behavior being different in every app on every computer. It's best left for meaningless tasks like switching between windows.

    --
    At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
    1. Re:Tabs suck. Use a space. by smellotron · · Score: 1

      Or you can intent with a single space and your code will be clear and easy to read instead of quickly rolling off the end of my 30" monitor.

      1. A single space is usually not enough indent to allow easy scanning of multiple nesting levels. Block-indentation has to be significantly different than intra-character indentation, or they start to blend too much (j and m are nearly half a space apart, depending on font face).
      2. Nested loops and conditionals should be limited in complexity. If you have something 5-6 levels deep, it probably needs to be refactored. Thus, seeing the code rolling off the edge of your monitor is really a code smell, and ignoring it by changing the indent level is akin to turning off compiler warnings "because they're annoying".
      3. 30" monitor and code is falling off the edge? There's something you're not revealing here, because you should be able to get 300-400 characters on a line. Either your font size is too big or you're not really using 30" of monitor for editing text. If you can't change font size because of a medical condition (or age), then goto (2), and I'll get off your lawn.
    2. Re:Tabs suck. Use a space. by harryjohnston · · Score: 1

      Out of curiosity, could you please define "intra-character indentation"? (Zero google matches.)

    3. Re:Tabs suck. Use a space. by Anonymous Coward · · Score: 0

      Welcome to 2010. Where developers have tools that can interpret the tabs, and print it at the applicable width. Go back to COBOL, thanks :)

    4. Re:Tabs suck. Use a space. by GigaplexNZ · · Score: 1

      A single space is usually not enough indent to allow easy scanning of multiple nesting levels. Block-indentation has to be significantly different than intra-character indentation, or they start to blend too much (j and m are nearly half a space apart, depending on font face).

      If you care about code indenting and aren't using a monospaced font, you have other issues to worry about here...

    5. Re:Tabs suck. Use a space. by smellotron · · Score: 3, Informative
      Sorry, there's probably a better phrase for what I'm trying to describe, and /. is mangling my attempt at ASCII art. Replace these underscores with spaces and you'll see the effect I'm going for. When L (and most characters in a fixed-pitch font) is the leading character in a line, it is visually as far-to-the-left as possible. However, some other characters (|ijf) will be centered, giving the appearance of being shifted slightly to the right. If the only indentation is a single space, the distinction between "real" indentation and leading whitespace inside the character's region is fairly small.

      L
      _L
      __L
      ___L
      ____L
      ____L
      ____L
      ____L
      ____L
      __|

      If you use more spaces for an indent level, even a dead, beaten horse could easily identify the nesting level.

      L
      __L
      ____L
      ______L
      ________L
      ________L
      ________L
      ________L
      ________L
      ____|

    6. Re:Tabs suck. Use a space. by MikeFM · · Score: 1

      Who doesn't use a fixed width font for coding? Barbaric. I find a little indention easier than massive indention because I can see it all in a glance without eyeballing around the whole screen. Of course I use a lot of whitespace in my code.. function doSomething ( int x = 62, char y = 'x' ) instead of function doSomething(int x=62,char y='x').. so maybe I don't need as much indention to make it readable. A lot of code I have to deal with isn't my code. Also I work a lot with nested objects that aren't in a loop but it's easier to read if indented to show the logic of how the components are nested. Have you seen some people code? They grow up with Perl and think they are brilliant if they can fit the entire program into a single line of code. I've seen a single line that is thousands of characters long. Very nice when the moron that wrote it has been fired for some reason (couldn't guess why) and hasn't documented anything. Luckily I haven't had to deal with that kind of code lately.

      --
      At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
  15. #include "less.h" by VortexCortex · · Score: 1

    If the VC IDE was as "smart" as any that I use it would just write a comment in the file containing the indent and tab settings, use default settings if the special comment doesn't exist, and allow the user to override / adjust those settings.

    e.g.
    /* MS_VC_INTENT=2; MS_VC_TAB=4 */

    It's the old "Use Comments for Meta-Data" trick (As seen everywhere else...)
    <!DOCTYPE> anyone?

    The point is that they didn't want to fix their own bugs related to the setting so they eliminated the cause...
    They got rid of the setting and claimed "It's not a bug, it's a feature!"

    1. Re:#include "less.h" by ljaguar · · Score: 2, Informative

      vim already does exactly this. http://vim.wikia.com/wiki/Modeline_magic

      it looks like this. (ts = tabstop, sw=shiftwidth) // vim: noai:ts=4:sw=4
            -or- /* vim: noai:ts=4:sw=4
      */
            -or- /* vim: set noai ts=4 sw=4: */
            -or- /* vim: set fdm=expr fde=getline(v\:lnum)=~'{'?'>1'\:'1': */

      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.

    2. Re:#include "less.h" by Anonymous Coward · · Score: 0

      Yes, we know vim does that. Emacs does it, too. As do several other editors within the UNIX sphere of influence.

      Where the fuck do you think that VortexCortex got the idea from? It sure wasn't his own original idea.

  16. Tabs = Evil by Korbeau · · Score: 1

    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.

  17. The only way to maintain sanity by Technomancer · · 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 whitespace.
    Hello from the trenches ;-)

    1. Re:The only way to maintain sanity by daveb1 · · Score: 1

      Please provide proof of this happening. I for one, have never seen it. Stop using bad editors.

    2. Re:The only way to maintain sanity by rikkitikki · · Score: 1

      I've seen it. I wish I had mod points for him. The problem is that everyone treats whitespace alignment differently. On a large enough team over enough time, people who use tabs will start to mix tabs and spaces for alignment. Once that starts happening you'll get code / comments / ascii art diagrams all misaligned when viewed in someone else's editor who doesn't have the same tabwidth. The only reliable way to solve this for everyone is to force tabs-as-spaces (:set expandtab). That way the spacing is consistant on everyone's editor.

    3. Re:The only way to maintain sanity by IBBoard · · Score: 1

      What weird-arse editors are you using?

      Create file in VS.Net and put in tabs rendered at 8 spaces. Save. Copy to Linux. Edit with MonoDevelop, Eclipse, GEdit, Geany, etc with tabs rendered at 4 spaces. Make changes, with extra indent done at an extra tab deep (not spaces). Save. Copy back to Windows. Watch VS.Net render the code the same, except with the indents being wider. Line endings are about the only potential problem, but most IDEs handle that anyway and has nothing to do with tabs.

      Never had a problem with tabs until spaces get in the mix, and then different conventions completely screw up your code. Different conventions with tabs (2, 4, 8 or other depths) are all fine, don't require changes to source code for each developer who has a different preference, and doesn't mess up your version control history with superfluous changes.

      That is unless your developers are doing pointless and wasteful things like trying to align elements in in-line array initialisations (just indent them one level rather than getting perfect alignment, which will be messed up as soon as your variable name or type changes length) or trying to align multiple lines of method arguments (at which point you probably need to refactor to something more sensible anyway).

    4. Re:The only way to maintain sanity by Bake · · Score: 2, 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 :-)

    5. Re:The only way to maintain sanity by Peter+La+Casse · · Score: 1

      On a large enough team over enough time, people who use tabs will start to mix tabs and spaces for alignment. Once that starts happening you'll get code / comments / ascii art diagrams all misaligned when viewed in someone else's editor who doesn't have the same tabwidth. The only reliable way to solve this for everyone is to force tabs-as-spaces (:set expandtab).

      The superior solution is to force everyone to use tabs for indenting, and then let people adjust their editors to display whatever tab size they prefer.

    6. Re:The only way to maintain sanity by IBBoard · · Score: 1

      Just like how everything is nice and neat with spaces until someone puts spaces in (and you're not using as wide a width for your tabs as they used for spaces) ;)

      That's the somewhat circular argument that works either way around - mandate one convention then have someone different use the other and your convention is broken and things don't look right. The difference is that "use tabs as the convention" lets you be flexible with indent width between developers but "use spaces as the convention" means everyone has to a) use the same width, even if they don't like it or b) screw up the VCS history with indentation fights as everyone keeps re-indenting to what they prefer.

    7. Re:The only way to maintain sanity by jgrahn · · Score: 1

      That's the somewhat circular argument that works either way around - mandate one convention then have someone different use the other and your convention is broken and things don't look right. The difference is that "use tabs as the convention" lets you be flexible with indent width between developers

      Seriously, you people who argue for this one must all use IDEs and never let the code out of the IDE. In my world, code gets

      • copy&pasted into mail, Usenet, README files, various document formats
      • run through less(1), grep(1) etc and viewed on a Unix terminal
      • diffed and merged in various tools
      • printed on paper (rarely)

      With "indent with TABs" as a rule, I'd have to look at the code with an 8-space indent in almost all of the cases above, because even though text editors often have the modify-the-tab-width feature, most tools *don't*. Even if they had, there's no way I'd reconfigure my whole environment every five minutes between the normal 8-width-TAB mode and a shorter one like 4.

      I think most people agree that an 8-spaced indent width is hell to read, regardless of programming language.

    8. Re:The only way to maintain sanity by IBBoard · · Score: 1

      Seriously, you people who argue for this one must all use IDEs and never let the code out of the IDE.

      Nope, wrong :) I do PHP, Java and C# coding, plus some tinkering in other stuff.

      copy&pasted into mail, Usenet, README files, various document formats

      Mail is rare. Usenet never (not needed to). Readme files and Wikis get code dumps. I've put it in Word documents as well (and tabs are definitely better there).

      run through less(1), grep(1) etc and viewed on a Unix terminal

      Yep, done that with my code. Don't see what difference tabs versus spaces make - you're either seeing X character widths of tab or X spaces. Any tweaks on my server are done with Vi.

      diffed and merged in various tools

      Occasionally - mainly the IDE's built in one (Eclipse and MonoDevelop), plus diff and some GUI tool or other on Linux. Currently Diffuse, but I've used others (most of which were quite similar to diff)

      printed on paper (rarely)

      Again, rarely, but I have done it on occasion. As with the pasting to Word documents, tabs seemed like an advantage there.

  18. TABS by Anonymous Coward · · Score: 0

    Terrific Alternative, Beyond Spaces!

    1. Re:TABS by RayMarron · · Score: 1

      Is that you, Gary Busey?

      --
      ON DELETE CASCADE
  19. Isn't 8 the "standard"? by VortexCortex · · Score: 1

    Standardized tabs was great back in the old "10: if ( x ) goto 100" days...

    But today 8 spaces per tab is far too much for most folks.
    Nearly all newer code has portions that are deeply nested.

    if ( x ) {
            x.addEventListener (
                    "hover",
                    function() {
                            window.status = "Hovering Over X";
                            x.changeColor (
                                    {
                                            text: "green",
                                            background: "black",
                                            outline: "white"
                                    }
                            );
                    },
                    true
            );
    }

    This is a mild example of 5 levels of nesting.

    Some code is more deeply nested than others, and some fonts are wider than others.
    Changing the tab spacing let's us see more without having to scroll horizontally decrease our font size.

    Here's the same code with 1/2 the tab width.

    if ( x ) {
        x.addEventListener (
            "hover",
            function() {
                window.status = "Hovering Over X";
                x.changeColor (
                    {
                        text: "green",
                        background: "black",
                        outline: "white"
                    }
                );
            },
            true
        );
    }

    What looks fine on my screen may look very different on someone else's.
    Using tabs and editors that allow tab size adjustment allows coders to manage the source code more efficiently.

  20. Editor Features by dziman · · Score: 1

    Honestly, where is the editor that has at least as much functionality aimed at a developer as a word processor? I'm not saying the SAME functionality, but an equal amount of functionality.

    As for the same functionality, starting with a spell checker for comments (in the very least) would be kinda nice.

  21. How is newline invisible by SuperKendall · · Score: 1

    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.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:How is newline invisible by poopdeville · · Score: 2, Informative

      If \r and \n are "visible", then so is \t.

      --
      After all, I am strangely colored.
    2. Re:How is newline invisible by Qu4Z · · 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.

    3. Re:How is newline invisible by harryjohnston · · Score: 1

      Thank you! That says exactly what I was trying to, but much better than I was managing to say it.

    4. Re:How is newline invisible by Chirs · · Score: 1

      I view tabs not as semantically meaningful, but as a quicker alternative to dealing with multiple spaces. When reworking code, I find it easier to add/delete a single tab than multiple spaces.

      Generally I use tabs for logical indentation, then spaces for visual alignment. That way the code will align properly no matter what tab spacing is used by the person reading the code.

    5. Re:How is newline invisible by Ichijo · · Score: 1

      Generally I use tabs for logical indentation, then spaces for visual alignment. That way the code will align properly no matter what tab spacing is used by the person reading the code.

      I wish I could mod your post up. I use your way, and it works well, at least until we get elastic tabstops.

      --
      Any sufficiently unpopular but cohesive argument is indistinguishable from trolling.
  22. Comment removed by account_deleted · · Score: 4, Insightful

    Comment removed based on user account deletion

  23. 0th law of indenting by Anonymous Coward · · Score: 0

    tab = every 8 columns

  24. How you win the FP by symbolset · · Score: 0, Offtopic

    If you're curious, here is how you win the first post thing. Getting in first is not enough. It's a grand start though, and I'm glad you've learned the trick. I'm looking forward to what you can do with it. /. is on its way down, but the things you learn here will be useful elsewhere too.

    First, capture their attention by twisting a common meme or modern topic in the subject.

    In the body, capture their attention again with a concept that challenges the common thread, and close the first paragraph with a short intellectual call. Don't use the subject line as the introductory sentence as some people really hate that and will mod you down for it no matter how good your post is.

    Once you have their attention you can push your meme without let as long as you are carefully correct or obviously intentionally incorrect to push the humor. Don't switch from humor to serious or vice versa - it doesn't work. If you have advanced trolling skills you can leave an opening here for correction so that you can amplify your message amongst the replies - but be right because these folks will school you. This is not the CNet crowd. Limit yourself to three or four paragraphs, or the Wall-O-Text haters will mod you down (I'm well over their limit here but I don't care because I have near perfect Karma. I can afford to school you).

    Nowhere in your post vary from the thread topic. You can do that deep in the thread but you can't get away with it in a first post.

    Close with an action item, because if you've entertained them they want to reward you with forward action. The "I Am Foredecker" tagline is awesome but it's not an action item. Jive?

    Oh, and you have about 180 seconds to get all that done if you're good, or 12 if you're not. It helps to have some copypasta handy, but if you can't tailor it in time it's just wasted because they'll tear you up.

    You're doing fine - keep it up.

    --
    Help stamp out iliturcy.
  25. Oh cry me a river by overnight_failure · · Score: 3, Funny

    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*

  26. Finally! by daveb1 · · Score: 0

    Finally us tab users have our *rightful* revenge! use tabs or be re-indented!

  27. Do you actually use the IDE? by pclminion · · Score: 0

    How many people actually use the VS IDE? Where I work, we compile with Visual Studio, but among my team there is only one person who actually edits in the IDE. We egg him about that from time to time, in good nature. To each his own, I hate the IDE, but the debugger is okay. Just because you're using Visual Studio doesn't mean you have to use the IDE.

    1. Re:Do you actually use the IDE? by Sowelu · · Score: 1

      Probably more people than you'd think. It serves my professional and hobby needs extremely well, personally. I wasn't a big fan before the 2008 version, but I'm quite happy now.

  28. TABs are for TABles! by mangu · · Score: 4, Informative

    when I open the file my editor represents the tabs as width as two spaces, while my colleague uses a four-spaces-for-tabs setting as he prefer that way.

    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.

    1. Re:TABs are for TABles! by mangu · · Score: 1

      why on earth is everyone using _spaces_ to format text and stuff? spaces are for separating words, tabulations to perform column indentation. as easy as that.

      You should have dictated that rule before anybody started using computers. The advantage in using tabs is a theory that only holds true in the minds of people who insist on using them.

      As it is now, tabs are a total mess. Go take a look at any open source project that has more than one contributor. You'll find all sorts of mixed space+tabs indentations.

      Unfortunately, there's no solution for this mess, if you replace all tabs with a fixed number of spaces that will fuck up the version control. Even then, for some projects this is the best solution, create one version that's the replacement of tabs with spaces, there will be no problem after that.

      The only way to make sure you are not creating problems for the future is never use tabs in new code, this is a rule I enforce very strictly on any project I'm coordinating.
       

    2. Re:TABs are for TABles! by Anonymous Coward · · Score: 0

      cindent on pre commit hook.

    3. Re:TABs are for TABles! by IBBoard · · Score: 1

      Why enforce never using tabs? Why not enforce never using spaces? Tabs are more flexible than spaces (developers can do their own width if they want) and as long as you're using *only* tabs then you're fine, just the same as if you're using *only* spaces then you're fine. "Only use spaces because tabs mess it up" is specious reasoning, because the inverse argument of "only use tabs because spaces mess it up" applies equally well.

      As for the mess of code in OSS projects: 1) I'm sure it happens in commercial software as well, 2) that is what conventions are for - just convert the patch before you apply it and 3) decent IDEs (like Eclipse) will let you auto-format code, including swapping spaces to tabs for indentation, which ensures everyone uses the same and that copy&paste from other sources doesn't mess things up.

    4. Re:TABs are for TABles! by Anonymous Coward · · Score: 0

      for some projects this is the best solution, create one version that's the replacement of tabs with spaces, there will be no problem after that.

      How is using tabs worse than using spaces in this regard? If someone decides they like 4 spaces for indentation instead of 3, you run into the problem with your version manager. Tab width is stored locally on the client machine and it's stored as a single character on the VM. So if everyone uses tabs, they can set the indent to whatever they want and the version control doesn't have to worry about how many spaces the developer indents. It just needs to know that there is an indent there. With spaces, you have developers that open up their code and have the editor auto format the code to their 2 or 4 spaces convention and you just increased your delta size by a factor.

      The only way I can think of (besides standards) to get around version control bastardization would be to send each file that's checked in through a standard format app before it's delta is created.

    5. Re:TABs are for TABles! by mangu · · Score: 1

      Why enforce never using tabs? Why not enforce never using spaces?

      Because using only spaces never causes confusion. Using only TABs can cause confusion in many cases, even if one never uses spaces for indenting.

      For example, you comment one line temporarily for a test. What happens to the tab that's now following a start comment character(s)? You merge two lines into one, what happens to the tab characters that are now inserted in the middle of a line? You break one line into two, will you need to convert the spaces into tabs? You cut and paste text from somewhere else, how will you make sure that the indentation contains only tabs? Have you ever copied text from a web page? From a PDF file? From a scanned+OCR'd paper?

      How can you ever be sure that in those and many other situations that all your lines contain the exact number of tabs? How can you be sure that your OCR, your document editor, and your PDF reader are configured to the same tab width as your code editor?

      We have one character that means 'blank', having another one just for the sake of the few people who want a specially personalized indentation is a complication we can live without.

    6. Re:TABs are for TABles! by jgrahn · · Score: 1

      As it is now, tabs are a total mess. Go take a look at any open source project that has more than one contributor. You'll find all sorts of mixed space+tabs indentations.

      I don't doubt that there are spaces hidden in many blocks of TAB-indented code, and vice versa. I just have never seen that as a problem. But I don't misconfigure my editor with tab-width!=8. People who misconfigure will see a mess. I hope that's educational for them: it shows clearly that you cannot misconfigure your tab-width and cooperate with others. Not in plain text without any metadata for describing the TAB settings used.

    7. Re:TABs are for TABles! by IBBoard · · Score: 2, Insightful

      Because using only spaces never causes confusion. Using only TABs can cause confusion in many cases, even if one never uses spaces for indenting.

      I'd disagree there, but to each his own.

      For example, you comment one line temporarily for a test. What happens to the tab that's now following a start comment character(s)?

      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.

      You merge two lines into one, what happens to the tab characters that are now inserted in the middle of a line?

      What happens to the spaces in that situation? Same thing.

      You break one line into two, will you need to convert the spaces into tabs?

      Which spaces? Editors will have one of two behaviours: 1) be "intelligent" and keep the indenting at the same level (so it'll tab it the same depth) or 2) be "dumb" and drop it to the start of the line, at which point I tab it back to place with a couple of key strokes.

      You cut and paste text from somewhere else, how will you make sure that the indentation contains only tabs?

      How do you know that the indentation contains only spaces? ;)

      Have you ever copied text from a web page? From a PDF file? From a scanned+OCR'd paper?

      Yes, yes, no. In the first two cases it works sometimes and not others, depending on whether it was done with tabs or spaces. The advantage if it was done with tabs is that it'll work no matter my tab width, where as spaces are going to be wrong for someone who uses 8 where people use 4 or whatever.

      We have one character that means 'blank', having another one just for the sake of the few people who want a specially personalized indentation is a complication we can live without

      No, we have one character that means "insert a single character space, such as might be found between two words" and one character that means "move the text to a fixed position according to the tab stop/width". Why overload one character when you can differentiate with two? ;)

      How can you ever be sure that in those and many other situations that all your lines contain the exact number of tabs?

      How can you be sure that they contain the right number of spaces? Every time I've worked with space indenting then I've ended up realising that one method block was indented by 5 spaces instead of 4 only at the point where I paste some code that is indented 4 spaces. Tabs, on the other hand, are generally quite obviously wrong because they're a full layer of indenting out of step.

      How can you be sure that your OCR, your document editor, and your PDF reader are configured to the same tab width as your code editor?

      By configuring them? PDF shouldn't make a difference, since PDFs are about identical presentation. OCR and document editors are customisable, but even if they aren't then half of the point of tabs is that they can fit whatever width.

      If your OCR reads 2x8char tabs instead of 4x4char then you've got half the indentation when you read it and it needs fixing, but it is just as likely to read 10/11/13 instead of 12 or whatever when using spaces. That's just called sanitising your inputs. Besides, how frequently do most people OCR their source code?

      If people really want to use spaces then that's fine, I just find it interesting that so many of the reasons for spaces being better can apply equally well to tabs being better!

    8. Re:TABs are for TABles! by Anonymous Coward · · Score: 0

      Best practice is to use tabs for indentation and spaces for alignment. I can use a tab width of 3 and someone else can use 8, each person can see what he prefers, and there is no problem. Then I can space out things I want aligned, and it will look the same on my screen as someone else's.

      Hopefully, everyone's happy.

    9. Re:TABs are for TABles! by bar-agent · · Score: 1

      Best practice is to use tabs for indentation and spaces for alignment.

      That doesn't work so well.

      class foobar {
              const string<T> gibberish; // Here is a string that
      // gets filled with "ipsum" text.
      }

      Now, what are you going to use to align the second line of the comment? 30 spaces? No, you will not. You will use several tabs. And thus, it gets screwed up.

      --
      i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
    10. Re:TABs are for TABles! by bar-agent · · Score: 1

      You are assuming the comment is intended for a tooltip. I could have easily applied that style of commenting to a local variable or case statement, or I could be using an IDE that doesn't have tooltips at all, like gvim or emacs. Even in a Visual Studio shop, you'll see a lot of devs that prefer gvim or emacs.

      And this is not limited to comments. What about Java, Objective-C, Lisp, or Smalltalk code, where you often need to wrap arguments onto subsequent lines, but you have long names on the first line before you even get to the arguments?

      The point is, you often need to align things deeply, and you aren't going to type 20-30 spaces to do it.

      Until we get editors with line- or section-specific variable tab stops, and this information is preserved in the file, tabs should not be saved at all, or should always be saved as if they are 8 characters wide. You can use soft tabs through your editor, but the document needs to be saved with spaces.

      And, yes, this means you may be reading a file with indentation that is less or more than you prefer. Suck it up, you are a professional for God's sake. If you must, selected a bunch of lines and hit shift-tab and tab to indent them "properly."

      --
      i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
  29. Re:Let's sound like morons, anyone? by fedxone-v86 · · Score: 2, Funny

    This!

    --
    (USER WAS PUT ON PROBATION FOR THIS POST)
  30. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  31. *I* decide how code are displayed by Anonymous Coward · · Score: 0

    I hate when some idiot/coworker think he has the right decide how I display the (his) source on my computer.

    First thing I change after installing VisualStudio are the tab setting, I really hope Tabs are default now, I want to force this setting down the throat of the space-guys.

  32. How difficult is it to provide another option? by master_p · · Score: 1

    Gee, how difficult is it to provide a 3rd option?

    tab size [ 4 ]
    indent size [ 4 ]
    sync tab to intent [ Y ]

    The energy spent for this is many million times more than the energy that would be spent by a programmer to put another check box there and synchronize the two options.

  33. Dream on, kid by westlake · · Score: 1

    Do they count all of us who bought computers with Windows 7 pre-installed and then deleted it?

    Does the geek count the beta testers who drove Win 7 past Linux no later than August of last year?

    Does he count all the close-out deals on the Vista PC that qualified for the free upgrade to Win 7?

    Net Applications publishes web-based stats.

    Real users accessing real sites.

    Heavily trafficked sites like Amazon, ESPN, Google - and Mozilla.

    You don't boot into another OS to access the headline news from Fox.
         

  34. tools makes the difference by Anonymous Coward · · Score: 0

    These discussions usually come dragging with lots of arguments why tabs are bad. None of which are relevant when using VS, because it a *smart* and modern editor. 30 years ago spaces was the best choice when indenting code, maybe.

    Recently people has even began to evaluate/use non-proportional fonts when displaying source code because it's easier to read.

    Languages with upper case keywords (BASIC) was also phased out one or two decades ago because it was hard/slow to read. Thankfully SQL allows lower case, though some stubborn people still write SQL uppercase, which makes maintenance work harder/more expensive.

    But be cautios, several versions of Visual Studio (and windows in general) have changed/enlarged the default fonts, making less rows visible. It's impossible to compact current VS 2008 fonts size to VS 6.0 size. Changing from Courier New 10pt (VS2008 default) -> Courier 9pt (VS60 default) helps a lot though.

  35. For a better file format by stew77 · · Score: 1

    Frankly, I think that plain text is a terrible format for source code. It unites content and presentation instead of separating them. I'd much more prefer to use a system similar to HTML/CSS where one file dictates the actual code, and the other part how I want to look at it. This way, I can have a custom CSS that uses tabs and places opening curly brackets on a new line, and my coworker can have a CSS that uses spaces and puts the curly brackets at the end of a line.

    Source code formats could furthermore be in a hierarchical XML structure, making loops child nodes of functions which are child nodes of class nodes. This would save all the guesswork and black magic that currently goes into syntax highlighting and code folding.

    No more will my SVN logs and diffs be messed up by a supid text editor insisting on changing all line feeds. No longer will there be any discussions about code formatting guidelines.

    This is 2010, why are we sill saving code in dumb text files like in 1960?

    1. Re:For a better file format by tjstork · · Score: 1

      This is 2010, why are we sill saving code in dumb text files like in 1960?

      Because binary formats are unpopular, and any other format is well, just a text file.

      --
      This is my sig.
    2. Re:For a better file format by stew77 · · Score: 1

      Structured text formats with standard parsers and writer like XML are arguably smarter than than a dumb .c file.

    3. Re:For a better file format by jgrahn · · Score: 1

      This is 2010, why are we sill saving code in dumb text files like in 1960?

      Because binary formats are unpopular, and any other format is well, just a text file.

      I'd argue that XML is a binary format for all practical purposes. All your normal tools for handling text files are useless with it, so you need custom-made tools. Just like with a binary format.

      "Dumb" text files gives us freedom. Freedom to choose our own tools, freedom to let different tools cooperate, that kind of stuff.

    4. Re:For a better file format by tjstork · · Score: 1

      Structured text formats with standard parsers and writer like XML are arguably smarter than than a dumb .c file.

      It's all just something you would shove into a Boost Spirit grammar. The guy just nailed it.

      --
      This is my sig.
  36. What's amazing by tjstork · · Score: 1

    Isn't the tabs. Its that, despite a howl of protest on the main Microsoft board, they claim to be unable to add an input box and label to a form with a release date still undetermined. How long and how disruptive could this task possibly be when the macro solution someone came up with shows the integration of settings is at the u/i level?

    Honestly, I think the guy from visual studio lied.

    --
    This is my sig.
  37. Re: psychic by Anonymous Coward · · Score: 0

    /* vi: set ts=8 sw=4 sts=4 noet: */

    See? Not that hard...

  38. A Tab is 8 spaces nothing more, nothing less by smartin · · Score: 2, 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.

    --
    The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
    1. Re:A Tab is 8 spaces nothing more, nothing less by jgrahn · · Score: 1

      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.

      Especially not since Eclipse also enables indent-with-TABs by default -- if you have to tell everyone to reconfigure their editors anyway, you might as well tell them to fix their TAB width.

      (I have never actually seen it stated before that Eclipse comes with broken TAB settings, but we have had a lot of problems at work with broken code, which could be traced to Eclipse users. I just found it hard to believe a major IDE could be that broken by default. Unfortunately, *they* don't see the problem and the rest of us cannot find our way in Eclipse's myriad of configuration options.)

  39. Thoughts on Windows 7 by killmenow · · Score: 2, Informative

    Subject: ASSERTION

    Body: NOTHING RELATED TO ASSERTION

    You assert Windows 7 sucks but have nothing in your post's body to suggest why you assert this. I would like to know what's so bad about Windows 7 (other than it being a closed-source proprietary operating system).

    Because...I hate Microsoft's business practices. I hate the unethical behavior of the company's directors and executives. I hate many of their products because many of their products are de facto industry standards despite being demonstrably garbage. But I'm running Windows 7 Pro x64 now and you know what? I hate that I like it so much. Unlike the vomit-inducing Vista, Win7 does everything I want and feels as good with resources as XP, runs all the Windows specific apps I need without anally raping me with a bottle of WINE, drives multiple monitors without a hitch, has a sensible audio subsystem, a clipboard system that isn't all over the place, and runs VirtualBox with any and every Linux guest OS I need without as much as a hiccup.

    Sure, YMMV but IMHO 64-bit Windows 7 is absolutely the best operating system ever to come out of Redmond, WA. Is it perfect? Of course not. There's no such thing as a perfect OS. But I think it's pretty damn good. And this disturbs me.

    So please help me hate Windows 7. I feel dirty.

    1. Re:Thoughts on Windows 7 by MikeFM · · Score: 1

      To start off with it looks ugly. Not as bad as Vista or XP but still pretty ugly. Of course all Microsoft products look like they were designed by and for MySpace users. Windows is noticeably still slow. I especially notice when using the network. The same transfers take considerably longer when timed. Drivers never work right. Oops that scanner is two years old so I have to get a new one. Microsoft doesn't bother to keep the drivers up-to-date for whatever new OS they are pushing. Haven't tested for Win7 but I had a hell of a time with Vista apps that wouldn't run on 64 bit Vista and had no 64 bit version available. Why they even still offer a 32 bit OS I have no idea. What Windows specific apps do you need to run? I have one. It's a rare proprietary business app. I could rewrite it to be OS independent pretty easily is it's really just a terminal app for connecting to our ERP system. Games? Windows really is the only choice if you want to run games on your computer. I don't do much of that as I have game consoles and an iPhone. I don't hate Windows 7. I just don't like it. It is better than Vista. As you said any OS has issues.

      --
      At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
  40. You will comply by Anonymous Coward · · Score: 0

    If you like complying with dictates, you'll like this. If you prefer to make up your own mind, you won't.

    The former scare me.

  41. Source Metadata? by Anonymous Coward · · Score: 0

    I often see some metadata inserted by an editor (eg, vim) when looking at open source code. Examples of how this metadata (called "modelines") is used verifies that it is in fact used to control things like tab/space use. See Vim Tips Wiki, Modeline magic for the examples. From a little searching it seems this feature has existed for quite some time.

    Given that it exists in editors already, it would seem that the ability for an editor or IDE to use the metadata-given convention for saving the file, while using the user-given convention during view/edit of said file, would allow for your preferences to be maintained while you work and the project's preferences to be enforced when passing files back to it.

  42. Bummer by Anonymous Coward · · Score: 0

    Bummer.

    Since there are so many command line tools that treat tab=8 (or at least do so by default) I always set tab=8 so that my code can be viewed properly in the largest number of tools.

    However, I like my indent size to be smaller (I've settled on 4, though I'm flexible when maintaining somebody else's code).

    As long as I can set "use_tabs=no", I guess I don't really care so much.

    Tab=indent is a nice concept, but there are enough sub-indent alignment exceptions (erm ... in other people's code of course) that it never really looks right if you don't match the author's indent level.

  43. Hint for reluctant GPL compliance by ClosedSource · · Score: 1

    If you have to follow the GPL and release your code, but don't really want anyone to read it, mix tabs and spaces freely. Don't forget to be inconsistent about the number of spaces you use.

    This will make anal programmers' heads explode.

  44. hard tabs are environmentally friendly. by tomhudson · · Score: 2, 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 using a hard tab? Hard tabs mean less data to read and write, fewer characters to interpret at runtime, etc. The hard tab is not only good for performance, it's environmentally friendly.

  45. Easier Still by SuperKendall · · Score: 1

    I view tabs not as semantically meaningful, but as a quicker alternative to dealing with multiple spaces. When reworking code, I find it easier to add/delete a single tab than multiple spaces.

    And I find it easier still to hit "indent region" in whatever editor I am using to fix all whitespace across multiple lines at ones. There is no need for tabs in any modern editor (or even un-modern ones since plenty of old editors can just as easily re-indent code) because you are treating all whitespace blocks the same.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:Easier Still by EdelFactor19 · · Score: 1

      Have you ever tried working with others using a revision control system? unless you can magically get everyone to always adhere to an agreement on the spacing people are going to smack you everytime they go to do a code review and have to deal with all of the white space changes nested within every commit you make.

      That aside I also hit indent region, but my indent region is going to insert whatever ive told it to. If i said to use tabs it will, if i said to use spaces it will. Secondly I dont always like indent region when it starts getting something wrong or when I'm working in someone elses code who has their own indentation scheme which defferred from my editors, and i'm not in the mood to reset my whole editor for every couple of files.

      If you are starting from a clean code base with an enforced standard, this can work. But the problem is that in my admittedly still brief career, that seems to be as frequent as the base 'ideal' environment from newtonian mechanics... that is to say it almost never happens. I eagerly await when it does however.

      --
      "Jazz isn't dead, it just smells funny" ~Frank Zappa
      EdelFactor
    2. Re:Easier Still by SuperKendall · · Score: 1

      Have you ever tried working with others using a revision control system? unless you can magically get everyone to always adhere to an agreement on the spacing people are going to smack you everytime they go to do a code review and have to deal with all of the white space changes nested within every commit you make.

      I've used version control systems for decades.

      If that is causing you an issue you need a better diff tool, because all re-indenting does is change whitespace which you should be able to have a tool ignore (or highlight only real changes).

      However the conflicts you mention are much less likely these days, because most people on a project now are generally using the same editor and not configuring it very much so it's likely any variation from how your editor will indent is a hand-coded thing that should have had indent run over it anyway...

      That aside I also hit indent region, but my indent region is going to insert whatever ive told it to. If i said to use tabs it will, if i said to use spaces it will. Secondly I dont always like indent region when it starts getting something wrong or when I'm working in someone elses code who has their own indentation scheme which defferred from my editors, and i'm not in the mood to reset my whole editor for every couple of files.

      Just reformat the whole method or class or whatever. Again because re-indenting is so quick there's no cost, the diffs are enlarged but if you do an up-front checkin with the reformat only before you start work there's no need to review any of the changes, and you can get concise diffs for real changes from that point. Also I find much of the time, the code looks way better and is easier to read because over time few people have bothered to even indent consistently anyway.

      If you're working briefly in someone else's code then just reformat the method or function you are working in or just ignore formatting and let them reformat later.

      If you are starting from a clean code base with an enforced standard, this can work.

      It can work better with loose standards, because you simply re-format code you happen to be working in. You wouldn't move into an apartment and not buy any furniture, why should you be working in code you don't feel comfortable with? The whole point of having version control is that you should feel comfortable making massive changes, because it's so easy to go back if needed. So make full use of that ability to make your life easier and more productive in the process.

      Over many years I have learned, there are no rigid standards. It's like the war on drugs, the cost of enforcing rigid standards is just way too high and so it's actually pretty much never done except in extreme cases. As long as people can read code they should not get so uptight around every character being in an exact location, and indented code is as I said more readable anyway.

      --
      "There is more worth loving than we have strength to love." - Brian Jay Stanley
  46. Cross platform development by gpc01 · · Score: 1

    Our historical coding standards have been indent 4 and tab 8 for over 25 years and the code is in an archive system that allows the checking of differences between any two commits. Changing the indent format would make difference checking difficult with older revisions. We do cross platform development on VMS, Unix, and Windows and need to be able to debug on all three systems. If we used only tabs, the indents would make the code unreadable in the debugger on some systems. Sure, Windows is flexable enough to handle only tabs but the other systems are not. Changing thousands of files with millions of lines of code is not reasonable, and this is only our code. I'm sure our customers would have the same problems. Microsoft only asked their MVPs which predominately do only Windows development so they don't see the problem (or don't want to) that those of us who do cross platform development have with their decision.

  47. They did it to break a standard by swm · · Score: 1

    Tabs 8 is a standard.
    If everyone uses tabs 8,
    then it is easy to move code (and other text files) around.
    If everything is portable, and everything is interoperable,
    then the OS is just infrastructure, and you can use whichever one you like.

    That would be bad for MSFT.

    Indent is not a standard: everyone uses whatever they like.
    By tying tabs to indent, they scatter tabs all over the map,
    which effectively breaks the tabs 8 standard.

    Breaking standards promotes lock-in and monopoly.
    Microsoft is on the record as doing this to defend against competitive threats.
    (http://catb.org/~esr/halloween/).

  48. Please don't by symbolset · · Score: 1

    I wrote that post. It's a jerkwad post. It deserves to be modded down. I'd delete it if I could. Foredecker is a cool dude and deserves better treatment than that. He wasn't astroturfing - he's entitled to put his opinion here too.

    --
    Help stamp out iliturcy.
    1. Re:Please don't by Foredecker · · Score: 1

      Na :) Yours was a fine post...

      --
      Jibe!
  49. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  50. "Imagine a king who fights his own battles..." by Anonymous Coward · · Score: 0

    ... "Wouldn't THAT be a sight" - Brad Pitt as Achilles, son of Pelius, from the film 'TROY'

    Well, I for one, am seeing it in you @ least. I'll give you that. Essentially (& don't let this go to your head man, lol) You're a "King" @ Microsoft, & one who does fight his own battles (vs. the trolls here).

    (In any event? That's a rarity in this world. Always has been, always will be. I, for one, do respect you for it - it's not easy holding a job & tackling these trolls here I imagine because you have to do so with politeness, tacts, & facts to back you: They by way of comparison? Do not have to adhere to any standards of conduct - as they're trolls, lol!).

    By the same token though?

    Watch it man, with "sticking it out there"... (by now, after that statement? LOL, well - you KNOW who this is, this is just replying as a friend is all. I'd like to think of you as that, & I want you to think the same of myself by the same token).

    Plus, well, I love film (you know this by now as well probably based on some of my replies here)

    I tend to use it to make my points via analogies (best form I can think of, it's that or classical literature or biblical passages, but not everyone has those under their belts so film functions as a better "common ground").

    I had to put that above, but more importantly, THIS BELOW for your sake (because I have a small inkling of what it's like, but I think you do, moreso).

    This is out there in response to these idiotic trolls around here & in your defense, so here's another one:

    "I've been famous, for better or worse, for a long time now, &... I wonder if you know what it, REALLY means. Howard, we're... we're not like everyone else. Too many 'acute angles', too many eccentricities. We have to be VERY CAREFUL not to let people in, or they'll turn us into freaks... when my brother killed himself, there were photographers at the funeral. There's no DECENCY to it!" - Cate Blanchette (God, she's a great actress), as Katherine Hepburn in 'THE AVIATOR'

    In any event... well, there you are.

    Oh, last point: I sent you a last email or two as well, on pagefiles & something else to checkout too (great tool, your company can use it). So, read those mails too, when you get time, & please do get back to me on them also (in addition to our original discussions too. I'll be waiting until March, the "impromptu deadline" you yourself set, patiently here). Stay cool...

    1. Re:"Imagine a king who fights his own battles..." by Anonymous Coward · · Score: 0

      Why was this post not signed "-apk" with two or three lines of P.S. remarks?

  51. Awesome: Keep batting a 1000 man, lol! by Anonymous Coward · · Score: 0

    Heh, you're doing it with facts, the one weapon every troll has to outright bow to. Great job, I love it. You're a man after my own heart (lmao, you "KNOW" who). Heck, soon I'm going to be too busy to post here anymore for reasons I've written you in email.

    You've also functioned as somewhat of a "demagogue" to myself in regards to Mr. Ballmer in this post of yours. This is why I bring up the demagogue stuff crediting you with the data you supplied now and your thoughts on it, and thus I am forced to agree really. A leader, needs it. Every great one has had it: Passion and yes, ego/drive. A leader has this innately, but, tempered with analysis via the hard sciences & not just the pseudo science like logic (intuition imo @ least? Is superior in a way, & faster by far. Risk takers of all kinds use it, and look where they are? Nothing ventured, nothing gained... right?). On Mr. Ballmer, whom I didn't particularly respect because I believe that tech companies need a combined TECH PERSON as well as a MOVER & SHAKER - RISK TAKER MONEY MAN too... Perhaps I was being TOO "one sided" in my estimation of he. This is why hearing others words in places like this, makes you think over your own views, strengtening them, OR altering them @ least somewhat.

    I say this, because afaik? He doesn't possess the technical acumen of a Bill Gates (whom I respect IMMENSELY for his trackrecord, & call "King Billy" albeit not out of ridicule, but rather out of respect).

    Guess I will have to gauge Mr. Ballmer differently now for what you extoll as his relative strengths because you need passion and drive created out of it. You've spoken to me of this via email in fact, & so has my own brother recently (Like yourself, he is a management figure in a "Fortune 100" company that rivals or possibly exceeds the status of your own in fact in size/wealth (or better! However: I am not absolutely 110% sure though, & I'd have to look as to worth & standings (on all accounts noted by myself now), as I just don't have time now, as I am on the way to classes now furthering my education this a.m. & almost done w/ yet another degree around this science of computing for me, "last car to pass, here I go"!). Yea, I listen to he, & he is also Captain on the way to Major in the U.S. Armed Forces as well as being a Broze Star winner too for bravery in combat no less - I'm proud of he to NO end in fact on all fronts!).

    He too, spoke of leadership, ego, passion & drive too (& he is an expert in it without a doubt, leading said gov't. contracts money laden company year in & year out in what he does). He's my junior in age, but know what? I LISTEN (when he talks which isn't that much to me nowadays anymore, we live FAR apart is why).

    Now, I have to leave this site to concentrate on other things, but it's a shame. I have things to do, & my burning time on trolls here is not absolutely essential to I, however, for you? Acting as someone to "change hearts & minds" for your company perhaps (or perhaps only of your own volition only - only YOU know this)... well?

    Heh - You really DO "put it all together man", & nicely with the facts/figures/links. They're indisputable usually!

    Man so, per my subject-line above?

    DO keep it up, & about time. These guys will take pot shots at your man, to "make a name for themselves" & you have to give them kudos for courage on that note @ least... but facts & figures is the "DEATH OF A TROLL", everytime. Good job... see ya, "YOU KNOW WHO". lol!

  52. Ballmer keeps his promise by Anonymous Coward · · Score: 0

    This is Ballmer keeping his promise to "f.king kill Google" [that employs the BDFL of Python, which states clearly in PEP-8 "do not use tabs, use 4 spaces"]
    The most adequate reaction is to not use anything MS-related (that if you still keep doing that for some reason), because you've just got one more reason to avoid something because it stinks.

  53. Whose tab is it anyway? by EdelFactor19 · · Score: 1

    Until you are working on a piece of code with a friend who wants to be able to view the code with an indent/tab size of 8 and you are just dandy with 2,3, or 4. Now everytime you each commit you will waste some time redoing each others 'spaces' indentation levels or have to remember so send everything through a formatter first...

    OR you could just use tabs for indentation and then as long as you use a decent editor that can understand (emacs, visual studio, eclipse, etc) magically you can adjust the display and not the actual characters themselves. And avoid needless whitespace changes in version control.

    Yes this dives into space/tabs debate which I have no intention of dragging into here, but I'm making a point that it is NOT simple or trivial or efficient to just keep re-expanding your indentation everywhere you go.

    For the life of me I'm trying to grasp what the heck the difference between tab size and indent size... what does it mean for them not to be equal? I'm trying to grasp how the tab size of your code within visual studio has any relationship to its runtime behavior in usage with other products. if you are trying to print a tab as in the character '\t' isnt it just going to get printed however the reciever chooses to interpret the tab character?

    And if the other "program" is processing the code itself for you, maybe its time to get that programs creators to creep ahead into the future and embrace the reality that tabs could be of a configurable width..

    surely i'm missing something about the difference between the two. Even when I'm using no-tabs and spaces only I don't understand why they would be different

    --
    "Jazz isn't dead, it just smells funny" ~Frank Zappa
    EdelFactor
    1. Re:Whose tab is it anyway? by harryjohnston · · Score: 1

      Until you are working on a piece of code with a friend who wants to be able to view the code with an indent/tab size of 8 and you are just dandy with 2,3, or 4. Now everytime you each commit you will waste some time redoing each others 'spaces' indentation levels or have to remember so send everything through a formatter first...

      Or you could just suck it up and make a decision!

      But seriously, if there's some compelling reason to use tabs, and the inconvenience of not using them is greater than the inconvenience of doing so, fine. Both depend not only on the editor in use but also all the other context.

      Personally, I'm still not sure I approve of having more than one developer working on a particular piece of code at a time to begin with. (And get off my lawn!) :-)

      For the life of me I'm trying to grasp what the heck the difference between tab size and indent size... what does it mean for them not to be equal?

      The indent size is how many characters to the right Visual Studio jumps when the auto-formatting decides to increase the indent level. If this isn't equivalent to the length of a tab, then Visual Studio will add whatever combination of tabs and spaces is necessary. It might also delete existing spaces and turn them into tabs.

      For example, if the indent size is 6 and the tab size 4, the first indent level will be one tab and two spaces. If you then add an indent level, the two spaces will be removed, and two tabs added.

      By default, pressing the tab key adds an indent level rather than inserting a tab character.

      if you are trying to print a tab as in the character '\t' isnt it just going to get printed however the reciever chooses to interpret the tab character?

      Quite, and therein lies the rub. It means that every program that interacts with the code may need to be told how to interpret the tabs. If you're using command-line tools, there could be hundreds of different programs involved.

      surely i'm missing something about the difference between the two. Even when I'm using no-tabs and spaces only I don't understand why they would be different

      If there aren't any tab characters in the document, the tab length setting is unused, so it doesn't matter whether they are the same or not.

  54. Tabs are annoying by gatkinso · · Score: 1

    They totally break any semblence of WYSISYG formatting.

    Not to mention that they will totally screw you when editing makefiles.

    If you want to look at the code they way you like it... then I suggest you write it.

    --
    I am very small, utmostly microscopic.