The Relicans


Discussion on: Tabs or Spaces?

chaelcodes profile image
ChaelCodes • Edited


Allow users to determine what spacing they want while reading code. Many folks with learning or visual disabilities use this to make it easier to read. For some disabilities, 2 spaces is easier, and for some 8 is easier.

HOWEVER, tabs make perfect alignment hard. You can't Indent your methods to the depth of the first method call, because you'll be comparing tab spacing to characters. Even if you ignore that, a tab and then a space become very common, if you're trying to indent to match the first call, like

something = object.super_long_method_with(lots, of, arguments)
Enter fullscreen mode Exit fullscreen mode

One tab deeper is MANDATORY if tab spacing is modifiable.

Also, I just created that code example with spaces. I cannot create it with tabs in this forem web editor unless I copy/paste tabs. Which is annoying. Want properly spaced code in your StackOverflow question/answer? Probably a good idea to use spaces.


Everything is consistent all the time. You have complete control of your spacing, and whether it's on github, your editor, or the web, it always looks the same.

The complication

You can automatically convert files from tabs to spaces and spaces to tabs. Normally, accessibility defeat consistency any day, even with the StackOverflow argument, but the ability to convert files into readable formats means that you're weighing web editing of code samples and common language practice against anecdotal preferences from a community that knows how convert files. Even accessibility sites are split with tota11y using spaces and a11yproject using tabs.

Forem Open with the Forem app