Comment by godshatter

5 days ago

I'm still in the "tabs for indentation, spaces for alignment" camp. If you adhere to it, it makes your code look nice on any tab size.

For a solo project, sure, you do you. But for any meaningful collaboration, deliberately mixing tabs and spaces - and relying on a manual, semantic convention to use them the "right" way - will inevitably lead to a maintenance / consistency nightmare.

  • To add to your comment, it's kinda common to find projects that have spaces and tabs improperly mixed in the indentation. Making a quick search among the projects I have cloned, I'm seeing indentations like

      tab * 4 + space * 7 + tab * 2
      tab * 2 + space * 1 + tab * 1
      tab * 1 + space * 4 + tab * 2
      space * 16 + tab * 3 + space * 4
      tab * 4 + space * 2 + tab * 2 + space * 2
      tab * 3 + space * 3 + tab * 1 + space * 6
    

    The code ends up looking janked unless you use the particular tab-width of the space/tab-indenter[1], which isn't always 8. It completely defeats the whole purpose of the tab indentation.

    [1] On those first 2, given the odd (not even) number of spaces, it's likely that use of spaces was for alignment, but then a tab-indenter added tabs to that...