• Demonen
    link
    fedilink
    arrow-up
    25
    arrow-down
    1
    ·
    2 years ago

    I use tabs because I prefer 4-space indents and others might prefer 2-space indentation or the gross and unacceptable 6-space indentation.

    If more than one person is working on a code base, there will likely be more than one preference, and with tabs everyone gets to just set their own tab width.

    Yes, even the 3-space savages.

    • noisytoot
      link
      fedilink
      arrow-up
      7
      ·
      2 years ago

      Tabs work fine as long as you don’t align stuff. If you do, you have to assume a tab size and mix tabs and spaces.

      • edward
        link
        fedilink
        arrow-up
        8
        arrow-down
        1
        ·
        edit-2
        2 years ago

        Generally aligning stuff isn’t nice. But if you do, it’s tabs up to whatever level of indentation you’re at then spaces the rest of the way. So you wouldn’t have to assume a tab size. And the tabs and spaces have different semantic meaning (indent vs alignment) so mixing them makes sense. It’s even built into Jetbrains IDEs, where it’s called “Smart Tabs”.

        Although really just adding a level of indent is better than aligning.

      • gun
        link
        fedilink
        arrow-up
        4
        ·
        2 years ago

        This is a legit observation. However, I would argue that spaces needs a set indentation width anyway, so if tabs had a set indentation width that coders are expected to maintain when aligning code, it wouldn’t make a difference. Enforcing that in practice may be different, but in theory it works.

    • PeterPoopshit
      link
      fedilink
      arrow-up
      2
      arrow-down
      3
      ·
      edit-2
      2 years ago

      It’s OK, I replace all the tabs with spaces for uniformity. Tabs are stupid and they mess things up when I paste stuff. I like to watch the world burn.

      • edward
        link
        fedilink
        arrow-up
        4
        arrow-down
        1
        ·
        edit-2
        2 years ago

        Imagine not having an IDE that automatically fixes the spacing of pasted text.