Indentation TABS vs. SPACES
I don't know why it is so common to ban indenting with tabs and use spaces instead but I don't get it. I mean with tabs everyone can set up a good number of spaces which is good for reading, but if we use x spaces everywhere, then it is bad for a lot of people (for example for me, the most easiest to read is 4 spaces as tabs.).
Needless to say linters drive me crazy (puppet DSL, python - 2 spaces!) and I just HATE using spaces.
(Yes, thank you, I can set up my vim - but I don't want to. I just want to use literal TABS.)
12 comments
[ 1.8 ms ] story [ 77.7 ms ] threadWhen you mix tabs and spaces there's no way to get alignment correct. Indentation is fine, if that's all you ever use them for, but human behavior is non-deterministic and unenforceable, making for completely hosed up source when tabs are used for anything other than pure indentation. E.g., if you put a tab in for alignment, when you should have used spaces, your source file is hosed up.
Add on to that that many IDEs, editors, and build tool/tool hooks aren't smart enough to know when something is being indented vs. aligned, it's essentially impossible.
Until editors align properly with a single tab char (something even a word processor will not do) then spaces are the right way.
I was NEVER TABS until someone else asked me to consider why, and now we use tabs for that reason: everyone can have their preferred width.
if you work on a project with multiple collaborators pick one (i.e. tabs or spaces) and stick with it (i.e. enforce it during code reviews).
I personally use tabs but those get expanded to 4 spaces by Vim. Works for me!
If sometime in the future they device some new formatting standard it would likely supplant and deprecate tabs, but spaces I believe would always be a fallback option.