Slashdot Mirror


User: harryjohnston

harryjohnston's activity in the archive.

Stories
0
Comments
621
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 621

  1. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.)

  2. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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?

  3. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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?

  4. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.

  5. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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. :-)

  6. Re:How is newline invisible on Visual Studio 2010 Forces Tab Indenting · · Score: 1

    Thank you! That says exactly what I was trying to, but much better than I was managing to say it.

  7. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.

  8. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.)

  9. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.

  10. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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?)

  11. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.

  12. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · Score: 1

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

  13. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.

  14. Re:Tabs suck. Use a space. on Visual Studio 2010 Forces Tab Indenting · · Score: 1

    Out of curiosity, could you please define "intra-character indentation"? (Zero google matches.)

  15. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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?

  16. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · Score: 1

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

  17. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · Score: 3, Insightful

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

  18. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · Score: 1

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

  19. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.

  20. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · Score: 1

    How do you see the tabs?

  21. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.

  22. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · Score: 1

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

  23. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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? on Visual Studio 2010 Forces Tab Indenting · · 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!

  25. Re:Why put tabs in code anyway? on Visual Studio 2010 Forces Tab Indenting · · 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.