We argue a lot about the minutae of technology. But what's really important is: tabs or spaces?

We argue a lot about the minutae of technology. But what's really important is: tabs or spaces?

Homeless People Are Sexy Shirt $21.68

Nothing Ever Happens Shirt $21.68

Homeless People Are Sexy Shirt $21.68

  1. 2 months ago
    Anonymous

    whatever your coding standard recommends

    • 2 months ago
      Anonymous

      But why not just spaces? A tab adds unnecessary complexities

      • 2 months ago
        Anonymous

        Most coding standards enforce spaces anyway.

    • 2 months ago
      Anonymous

      If they are both treated the same in the language, tabs. If no one is ever going to touch the code other than you, it doesn't matter, but the question is dumb in this case anyway.

      right, because im a mainframe programmer
      [...]
      the correct answer

      Recommending this in a language standard feels like an extremely outdated idea, the vast majority of developers aren't using a barebones text editor that doesn't have to option to set tab sizes.
      If the language suggests using 2 space indentation like (old callback js) then just set the tab size accordingly.

      tldr tabs, ppl have preferences

      • 2 months ago
        Anonymous

        this
        with tabs you can set the spacing dynamically to suit your preference
        with spaces you're stuck with your font's width for each character.

        • 2 months ago
          Anonymous

          But then you can't force your coworkers to bask in the perfection of 3 space indentation

  2. 2 months ago
    Anonymous

    only degenerates use spaces

  3. 2 months ago
    Anonymous

    What possible reason is there to use spaces

    • 2 months ago
      Anonymous

      It's encoding independent. A space is a space in ASCII, EBCDIC, or any other encoding

      • 2 months ago
        Anonymous

        ah yes because every programmer decodes & encodes by hand.

      • 2 months ago
        Anonymous

        right, because im a mainframe programmer

        whatever your coding standard recommends

        the correct answer

    • 2 months ago
      Anonymous

      The default tab width is 8.
      In terminals, text editors, postscript, office applications, etc.
      It's too much. So editors that want to do any coding had to change it. And since they all do their own thing, we ended with .editorconfig.

      If you just stick with spaces, none of that bullshit is needed.

  4. 2 months ago
    Anonymous

    Always tabs

  5. 2 months ago
    Anonymous

    Always keep tabs on her
    Never give her space

  6. 2 months ago
    Anonymous

    This is a problem that doesn't exist
    Simply use your IDE's auto-formatting function and make the code look how you want it.
    This is why bullshit like python's forced indentation homosexualry is totally moronic.
    With like 3 buttons I can format it to how I like and you can still code how you like

    • 2 months ago
      Anonymous

      > auto-formatting function
      Yes I just love masses of completely redundant diffs.

      • 2 months ago
        Anonymous

        Easy fix
        Just make git remove padding whitespace and then reformat when doing diffs or displaying code online

        • 2 months ago
          Anonymous

          That is actually a fascinating idea. Though you can't just blindly clobber white space since in some cases its needed, you would need a language aware whitespace filter.

          • 2 months ago
            Anonymous

            Usually that's inside quotes of some sort, which is easy to do.

      • 2 months ago
        Anonymous

        >what is --ignore-revs-file

  7. 2 months ago
    Anonymous

    Tabs for indentation
    Spaces for alignment

    • 2 months ago
      Anonymous

      tabs for indentation, spaces for alignment. this is objectively superior and KYS if you disagree
      /thread

      this and only this

  8. 2 months ago
    Anonymous

    Spaces. Indent size doesn't need to be configurable.

  9. 2 months ago
    Anonymous

    tabs with an editor that converts them to spaces

    • 2 months ago
      Anonymous

      Simple as.

    • 2 months ago
      Anonymous

      this is the right answer and anything else is just moronic

  10. 2 months ago
    Anonymous

    Tabs are the only sane choice. It ends the indent size discussion. Go devs got it. To my delight Python can be tab too. 4 space moronation is Guido autism.

    • 2 months ago
      Anonymous

      > It ends the indent size discussion.
      No, what if you need to wrap a line? Should the continuation line be another 'tab' in, or partially in? If partially, then changing tab size will change the appearance of the partial tab (in spaces), and the magic of tabs is gone.

      Anyway, I can't believe there are tabs people still out there.

      • 2 months ago
        Anonymous

        why are you wrapping lines? manually babying code into something you think looks prettier?

        tabs are correct: a single character unambiguously communicates a single level of indentation

      • 2 months ago
        Anonymous
      • 2 months ago
        Anonymous

        >what if you need to wrap a line?
        you don't

      • 2 months ago
        Anonymous

        If you need to wrap a line, add a newline before the first long stretch, and then indent each subline with a tab. Like this.

  11. 2 months ago
    Anonymous

    Almost every space code base I have seen has completely messed up indentation. Its so easy to get your indentation misaligned, so you see random 3 space indents for example.

  12. 2 months ago
    Anonymous

    Tabs so people can choose how much indentation appears on their screen.

  13. 2 months ago
    Anonymous

    I don't care. The IDE should take care of it.

  14. 2 months ago
    Anonymous

    Tabs are better but I like me trusty space

  15. 2 months ago
    Anonymous

    always tabs.
    tabstop = 8

  16. 2 months ago
    Anonymous

    tabs for indentation, spaces for alignment. this is objectively superior and KYS if you disagree
    /thread

    • 2 months ago
      Anonymous

      Good luck actually doing this in practice.

      • 2 months ago
        Anonymous

        go fmt

      • 2 months ago
        Anonymous

        what do you mean, its easy, my editor even has a plugin for it

      • 2 months ago
        Anonymous

        What is the problem you see doing this in practice? I have never had a single difficulty with this.

  17. 2 months ago
    Anonymous

    elastic tabstops. failing that, tabs. i'm not a fan of being forced to read someone's shitty 2-space indent preference, nor of being unable to use a proportional font if i want, because spaces are rendered much too narrow.

  18. 2 months ago
    Anonymous

    Literally this is the one true purpose of the Tab key.

    • 2 months ago
      Anonymous

      Oh, and your file sizes will be smaller.

  19. 2 months ago
    Anonymous

    we never argue about the minutae of technology
    it's only bullshit like this every thread every day

  20. 2 months ago
    Anonymous

    Who the frick still uses Tabs in this day and age?

  21. 2 months ago
    Anonymous

    why does it even matter if it "looks different in different editors"? It's just some blank area on the left side of the screen.

  22. 2 months ago
    Anonymous

    tabs for indentation, spaces for alignment. anything else is an incurable mental illness.

  23. 2 months ago
    Anonymous

    No tab characters allowed in my repo

  24. 2 months ago
    Anonymous

    i have a suspicion that spacegays are sadists who enjoy forcing people to look at one-space or three-space indentation

  25. 2 months ago
    Anonymous

    tabs, i want to change the size of the indentation without making my code look like shit

  26. 2 months ago
    Anonymous

    >small brain
    4 spaces
    >big brain
    1 tab
    >galaxy brain
    make 1 tab output 4 spaces

    • 2 months ago
      Anonymous

      one would be lucky to find even one neuron inside your skull

  27. 2 months ago
    Anonymous

    Your editor should handle it for you.

  28. 2 months ago
    Anonymous

    checked
    always use tab expansion, this completely erases the whole problem. same buttons pressed, looks the same, feels the same.

    • 2 months ago
      Anonymous

      And creates a new problem.

      • 2 months ago
        Anonymous

        Seethe and dilate

      • 2 months ago
        Anonymous

        what problem does it create? does it trigger your autism?

  29. 2 months ago
    Anonymous

    Tabs for indentation, spaces for alignment, also checked

  30. 2 months ago
    Anonymous

    tabs are objectively better
    but most code bases are old and they force you to do spaces

  31. 2 months ago
    Anonymous

    Nice digits. I just use spaces for everything now. Hit tab and it adds enough spaces to match whatever the indention level is (usually 4). Simple and easy.

  32. 2 months ago
    Anonymous

    A space is always visually obvious, a tab is always visually ambiguous. And this aside from encoding. Tab is the clueless man's choice.

    • 2 months ago
      Anonymous

      >A space is always visually obvious, a tab is always visually ambiguous.
      Ambiguous? In what way?

    • 2 months ago
      Anonymous

      At least you cant place your cursor inside a tab indentation. Space sucks because you can easily end up misaligned.

    • 2 months ago
      Anonymous

      well said

  33. 2 months ago
    Anonymous

    >spacegays run away after all their arguments are BTFO
    Another win for tabchads

    • 2 months ago
      Anonymous

      we'll have to just keep dominating the industry I guess

  34. 2 months ago
    Anonymous

    Tabs would be better if there was better editor support for marking leading tabs and other tabs separately.

  35. 2 months ago
    Anonymous

    holy check 'em

  36. 2 months ago
    Anonymous

    spaces "just werk" but tabs are customizable

  37. 2 months ago
    Anonymous

    Spaces. Modern IDEs can auto-space however many if you use 2 or 4. Tabs are variable width depending on the editor and are sometimes huge and can be annoying to read.

    Spaces in a monospace font are always the same as the other characters so proportions are always the same too.

    Width that being said, I really don't care. There isn't an actual battle going on about using either one. Just match whatever you're editing and agree on one before a project begins.

    The real question to answer is about line endings. rn or just n? We all know which one should win

    • 2 months ago
      Anonymous

      >Tabs are variable width depending on the editor and are sometimes huge and can be annoying to read
      You... you know that you can change the size of tabs too, right?
      > rn or just n?
      RetVrn to tradition, 25

  38. 2 months ago
    Anonymous

    There is no reason not to use spaces. All the arguments in favor of tabs are inaccurate, outdated or plain wrong.
    >muh small file size
    Compress the sources in some way if that's a real concern. In fact, that's what literally everyone already does when they distribute them, but you don't know this since you don't program.

    >muh variable indentation
    Any decent editor can use whatever indent size you want with spaces too. Using spaces is not "forcing" anything on you. If you genuinely believe this, you are tech illiterate or don't program.

    >muh with spaces, code looks the same everywhere
    That's a feature, not a bug. To this day, nobody can agree on how to display a tab, while spaces are universally agreed to be one character wide, and that's how literally every computing device on the planet will display them.

    As pointed out previously, if you want to work on that code using a different indent size, any decent editor/formatter can deal with it and resize it just fine. You'd know this if you programmed, but you don't.

    >muh indentation and alignment are different things
    Yes, so what? No reason not to use spaces for both. It's simpler and more consistent.

    >muh some neckbeard said tabs are better
    They must get on with the times or provide rational arguments instead of relying on dogma. In fact, this silly debate is a thing only for languages with C-like syntax (usually C, C++ and Java). Virtually every other programming language uses spaces, for good reason: easier to guarantee small indent sizes for deeply nested code (no, that's not a bad thing in itself despite what Torvalds told you), more consistent and saves more horizontal space.

    • 2 months ago
      Anonymous

      >none of your arguments are important enough
      And what are your arguments for using spaces over tabs?
      Give me one good reason that space is better than tabs, however superficial as it may be. Just one.
      Keep in mind that with proper use of tabs for indentation like in

      , you can't argue for alignment breaking if someone uses a different tab stop.
      >easier to guarantee small indent sizes for deeply nested code
      Just how much deep do you need to go? It's not 1998 anymore, our monitors can easily display up to 120 characters in a line if not more.
      If you are on a VT100, then you can set your tabstop size at 2. I have enough space on my wide monitor to use 8-width tabstops. everyone is happy.
      No, you don't need to chain 10 if blocks together.

      >more consistent
      that matters why? Why do you care how someone else looks at your code on their own screen as long as it's aligned properly?

      >saves more horizontal space
      Not an argument for using spaces over tabs. this is an argument for using a smaller indent size and a shitty one at that (buy a wider monitor. 4:3 is obsolete)
      But if you must, tab gives you the option to use smaller indent size without fricking it up for everyone else as well.

    • 2 months ago
      Anonymous

      >Any decent editor can use whatever indent size you want with spaces too
      Didn't know this, but if you change the indentation size you'll have to change it back to the original indentation size before committing, which tacks an extra layer of complexity for literally no reason. Your workflow goes from
      >pull repo
      >start working
      >commit
      to
      >pull repo
      >reformat to your preferences
      >work
      >reformat back to original indentation
      >commit
      If spaces had any actual merit, this headache would be worth it, but they don't. They're less accessible, and harder to change
      >>muh with spaces, code looks the same everywhere
      >That's a feature, not a bug.
      RIP to people with fricked eyesight ig
      >deeply nested code
      In a language like C, in a domain where frickups have actual consequences, you want to reduce cyclomatic complexity as much as humanly possible

  39. 2 months ago
    Anonymous

    For me, it's Tabs with 4 spaces inserted

  40. 2 months ago
    Anonymous

    Tabs, and always set tabs to 4 spaces (which is the default standard in visual studio). If you have 8 space tabs like a moron then my code is going to look like shit on your computer and you're going to have to clean it up with some code janny formatting tool.

  41. 2 months ago
    Anonymous

    idk maybe check out the last 2000 threads

  42. 2 months ago
    Anonymous

    spaces are superior:

    >1. Its automatically enforceable: you can auto detect and deny PRs which contain tabs, you cant do the same if you're pro tabs
    >2. in the same way you can enforce character horizontal limits, which you absolutely should
    >3. its consistent. The question isn't "tabs vs spaces" but "tabs AND spaces vs just spaces"
    >4. it filters newcoders who think being pro spaces means you are supposed to press the space bar multiple times to make indents
    >5. its result in code looking similar everywhere which is something we clearly all agree is desirable from the fact that we ALL agree to follow a common codestyle anyway (every real project makes everyone follow a styleguide).
    I think its ironic that pro-tabs people are okay with restricting their freedom of code expressing, but when it comes to something as unimportant as indenting they are like NOOOOO I WANT MY OWN SNOWFLAKE SPACING its ridiculous

    the ONLY pro argument you can make for tabs is that they reduce file size but thats completely negligible, i would say in modern times but even in old times this was completely negligible.

    • 2 months ago
      Anonymous

      >its consistent. The question isn't "tabs vs spaces" but "tabs AND spaces vs just spaces"
      This is the main reason for me. Why bother having the extra overhead of tabs for indention and spaces for alignment. Well I guess maybe some madmen out there use tabs for everything, but I doubt that's common. It's easier to just use spaces. I don't really care about your special snowflake indention level settings in your editor sorry.

    • 2 months ago
      Anonymous

      >I think its ironic that pro-tabs people are okay with restricting their freedom of code expressing
      The frick are you on about schizo?

      • 2 months ago
        Anonymous

        when you work with other people you follow a styleguide anway that dictates how to name variables, how to layout code, when to indent and when not to.

        Its ironic people are fine with all that but not that everyone should just agree to use the same indent amount.

        • 2 months ago
          Anonymous

          Who said nobody has any opinion about other code styling issues? The thread is about tabs and spaces specifically. Why would anyone bring up capitalization issues in this thread?
          Except in other big controversial styling debates, both sides kind of have some merits to them. While space has zero merits to tabs.
          All points brought up by space shitters are either invalid completely or are issues with tab indenting that is equally as bad as space indenting.

          spaces are superior:

          >1. Its automatically enforceable: you can auto detect and deny PRs which contain tabs, you cant do the same if you're pro tabs
          >2. in the same way you can enforce character horizontal limits, which you absolutely should
          >3. its consistent. The question isn't "tabs vs spaces" but "tabs AND spaces vs just spaces"
          >4. it filters newcoders who think being pro spaces means you are supposed to press the space bar multiple times to make indents
          >5. its result in code looking similar everywhere which is something we clearly all agree is desirable from the fact that we ALL agree to follow a common codestyle anyway (every real project makes everyone follow a styleguide).
          I think its ironic that pro-tabs people are okay with restricting their freedom of code expressing, but when it comes to something as unimportant as indenting they are like NOOOOO I WANT MY OWN SNOWFLAKE SPACING its ridiculous

          the ONLY pro argument you can make for tabs is that they reduce file size but thats completely negligible, i would say in modern times but even in old times this was completely negligible.

          >>1. Its automatically enforceable: you can auto detect and deny PRs which contain tabs, you cant do the same if you're pro tabs
          You can just as easily deny deny PRs that have lines starting with spaces. That means nothing.
          Also someone indenting with spaces doesn't automatically mean they used the correct amount of spaces, it should be either checked manually same as with tab indents or have a complex automaric format checker that can handle both tab indent or space indent anyway.

          >>2. in the same way you can enforce character horizontal limits, which you absolutely should
          Can enforce column width just as easily with tabs. Choose a default tabstop size same as you do with your space counts and enforce column width with that tab size. If someone wants to use a different tabstop size, they'll adjust their column width accordingly themselves, you son't have to worry about it.

          >>3. its consistent.
          So is tab indenting, if you use is consistently
          >The question isn't "tabs vs spaces" but "tabs AND spaces vs just spaces"
          Nobody pretended otherwise. But in what way does that matter at all? How is using just spaces is better in any shape or form?

          >>4. it filters newcoders who think being pro spaces means you are supposed to press the space bar multiple times to make indents
          Tab indenting does a better job at filtering idiots, proof for it exists in this very thread.

          cont

          • 2 months ago
            Anonymous

            jesus christ
            its insane people like you live in the same world as me

          • 2 months ago
            Anonymous

            Nice argument there, homosexual

    • 2 months ago
      Anonymous

      >>5. its result in code looking similar everywhere
      Why do you care how code looks like on other people's screen? Do you just enjoy enforcing your shitty rules upon others or do you have an actual reasoning for demanding control over indent size on people's screen?
      >which is something we clearly all agree is desirable from the fact that we ALL agree to follow a common codestyle anyway (every real project makes everyone follow a styleguide).
      Except in other styling debates, there is no solution to make the code look in a way that makes everyone happy. If CamelCase naming convention is chosen, there is no way to get snake_case names on my screen if I prefer that while someone else gets to keep their CamelCase.
      With indenting debate however, a solution exists to make everyone happy. And that solution is to use tabs. Then everyone can be happy regardless of their preferred indent size. But I guess you authoritarian little shits can't accept that, can you?

  43. 2 months ago
    Anonymous

    tabs for indentation, spaces for alignment master race

  44. 2 months ago
    Anonymous

    OP here, mfw the arguments are still happening

  45. 2 months ago
    Anonymous

    i use tabs because if i use 5 spaces then i will be murdered in the night

Your email address will not be published. Required fields are marked *