you are viewing a single comment's thread
view the rest of the comments
[–] 75 points 6 months ago (8 children)

That's the beauty of tabs, it can be whatever you want.

But the correct answer is 4

  • source
  • parent
  • hideshow 8 child comments
  • [–] 21 points 6 months ago (5 children)

    I'm a spaces guy, but agree on the 4. A coder told me decades ago that 4 is better than 2 because if your code starts wrapping due to too many indents you should be refactoring it into functions anyway.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 13 points 6 months ago (4 children)
  • [–] 14 points 6 months ago (3 children)

    In part, because it forces 2-space tab users to confront the indentation issue above

    Also there are no drawbacks.. I still hit the tab key to indent (and shift tab to dedent). My editor does the rest.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 14 points 6 months ago (1 child)

    The drawback to spaces is that people with vision issues or dyslexia lose the ability to make the code more readable in their IDE by adjusting tab size.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 5 points 6 months ago

    I can't speak to dyslexia (but in would guess that 4 spaces is easier than 2?).

    At my last job we had a default linter policy of 4 spaces across all languages (python, JS, rust, mostly). We also had a blind coder. He never mentioned it. I'd guess screen readers are capable of dealing with it these days?

  • source
  • parent