1. 9
  1. 10

    With storage space being plentiful and cheap these days, any minor benefit that was once gained by using tabs instead of spaces is gone. The benefit was so small that even inf the Olden Days (and especially on record-oriented filesystems) it probably didn’t matter, and the space argument was made after the fact as a post hoc justification.

    The best justification for using “real” tabs versus spaces is this: the file looks right to whoever is viewing it, assuming they have their editor set up to display tabs the way they want.

    The best justification for using spaces is that the file looks the same no matter who’s looking at it, or the configuration of the editor.

    The second best justification for spaces is that it’s very easy for source code to get visibly mis-indented with real tabs (things that used to line up now don’t because the width of the preceding text is different enough that the tab multiple jumps by one).

    The compromise is Elastic Tabstops, but it requires editor support.

    1. 4

      The best justification for using spaces is that the file looks the same no matter who’s looking at it, or the configuration of the editor.

      Not necessarily true, for example if somebody is using a variable width font.

      The best justification for using “real” tabs versus spaces is this: the file looks right to whoever is viewing it, assuming they have their editor set up to display tabs the way they want.

      Two more reasons for using tabs:

      • Spaces require the editor to (a) support inserting spaces instead of tabs, and (b) be configured to do so (or else you have to hit the spacebar 4 times in a row like that girl on Silicon Valley).
      • If you use tabs for indentation and spaces for alignment, converting to all spaces is a simple text substitution; going the other way is a lot harder.
      1. 5

        Next up on Eternal Holy Wars: fixed-width vs variable-width fonts for coding.

    2. 3

      The author gives reasons to avoid mixing tabs and spaces for the same purpose, but I feel like that’s taken for granted in most arguments these days. Using tabs in a tabstop-agnostic way avoids the potential pitfalls he mentions, with the added benefit that people can choose how many columns to indent for each indentation level.

      1. 1

        Holy war? For the love of God, the linked page is seventeen years old.

        There is already a tag for ‘historical’. I’m starting to wonder if we don’t also need one for ‘archaeological’ at the rate these old bones keep getting dug up…

        1. 2

          It’s still a holy war. Those don’t ever end, you know. This could have been written last week, except then it would mention gofmt!