I agree with this to the extent that I will say it's the sensical answer. I think that tabs are an obvious choice because they are semantic intendation rather than generic spacing. For this reason the front-end can render them with 2, 4, 8 or whatever amount of spaces, without requiring the code be changed.
Tabs. There's a reason we put tab key on every keyboard out there, it is built specifically for alignment
The word tab derives from the word tabulate, which means "to arrange data in a tabular, or table, form." When a person wanted to type a table (of numbers or text) on a typewriter, there was a lot of time-consuming and repetitive use of the space bar and backspace key. — https://en.m.wikipedia.org/wiki/Tab_key
For a very long time, I thought tabs were the way to go. It provided the most compatible coding style between my languages (Lua, C, Assembly, etc.) The only sticking point was JavaScript, which used spaces. But now that I develop across devices, I'd have to say spaces simply because of encoding issues re: Unicode. Sure, you could ensure your encoding type, but that's an extra step you shouldn't have to do.
Tabs. Spaces are how you end up with one class where one method is 2 space indent and another is 4 and another is 12 because your team all has different preferences (and two of them are insane.)
Tabs means everyone can use whatever preference they want and not be bothered by anyone else's preference.
The variability in the ways tabs are displayed, which you can not control, make tabs a non-starter.
Spaces always look like spaces. So when you use them, your text looks the same wherever it is displayed, and that requires no additional work.
The one caveat here (if you don't already know) is that the `make` utility has never been updated to allow spaces, even to this day. So, you must use hard tabs in Makefiles.
Also worth knowing is that Python's official style guide, PEP-8, insists on spaces (specifically, 4 spaces), and the officially-provided formatting tool for Go uses tabs (a decision that I was most displeased with). It's physically possible to go against these recommendations, but you're not likely to find any community cooperation for that decision if you're working in those two languages.
67 comments
[ 5.0 ms ] story [ 135 ms ] thread[0]:https://en.wikipedia.org/wiki/Whitespace_(programming_langua...
If it's empty, spaces.
Tabs can be messy across version control and multiple users with differing OS / editor.
Configuring your favourite text editor to interpret a tab key press as 2, 4 or whatever number of spaces for your project is trivial.
If people choose a different way, is because they have a reason, or they don't care.
If you're not sure, use whatever the file already uses, or the way I described above, or whatever makes you feel fuzzy inside. In that order!
To insert 4 consecutive spaces at once.
...but using the tab key /glares at Silicon Valley/
And I go with whatever the current file is. If I didn't make the file I respect the style of whoever did.
For my own files I prefer spaces.
Tabs means everyone can use whatever preference they want and not be bothered by anyone else's preference.
To go further, always use a standard formatting tool (gofmt, clang-format...) before committing code.
But compatibility trumps awesomeness, so spaces.
The variability in the ways tabs are displayed, which you can not control, make tabs a non-starter.
Spaces always look like spaces. So when you use them, your text looks the same wherever it is displayed, and that requires no additional work.
The one caveat here (if you don't already know) is that the `make` utility has never been updated to allow spaces, even to this day. So, you must use hard tabs in Makefiles.
Also worth knowing is that Python's official style guide, PEP-8, insists on spaces (specifically, 4 spaces), and the officially-provided formatting tool for Go uses tabs (a decision that I was most displeased with). It's physically possible to go against these recommendations, but you're not likely to find any community cooperation for that decision if you're working in those two languages.
You can absolutely control the way tabs are displayed. Using a poorly built tool that doesn't give you that option is the non-starter.
The rest of what you said are just random facts that don't really support your preference.