The only true answer to 'tabs vs. spaces'
garrit.xyz
garrit.xyz
I hung onto tabs for the reasons mentioned in the article: It doesn't require agreement on the number of spaces for an indent. I always liked 3 (a bit bigger indent than 2, not so much space as 4), but tabs meant people could pick whatever they liked. A single character that means "another indentation level" makes a lot of sense to me.
But, at least in the Python world, spaces have won. So I switched, and whatever.
I have bigger fish to fry, I'll use whatever. If I was on a team that chose tabs, I'd be fine with it. But I'd also be fine with spaces. Life is too short to care, tooling largely just takes care of it.
What's the point of even existing if you can't argue over minutia?
This comment is what sold me https://github.com/prettier/prettier/issues/7475#issuecommen...
They do care greatly about sticking 100% to an auto-code formatter, not for their benefit of reading other's codes, but so they didn't need to worry about accurate formatting themselves, which is another excellent reason to just pick a code formatter and use it on every commit religiously.
"I don't care, as long as it is consistent per codebase."
I work on a codebase that my team owns, and we use spaces. I work on another codebase another team owns, and it uses tabs. I use whatever the codebase wants.
If an application is capable of rendering a tab as say N px of white space why can't it render 2 spaces as N px of white space?
That's definitely application specific. I've seen other applications (not IDEs) use variable width tabs so that tabular data (Tables) would line up very well with only a single tab.
I agree that parsing a known correct file is trivial. Wouldn't a trivial thing be solved by now?
To me, "can someone without good vision work with this code" was all the argument needed. Preferences, sure, accessibility though? Why not just make it simple?
Rust also disappointed me on this, I just have never heard an argument for spaces that comes close to functional rather than just aesthetic. I don't honestly know why this is such a controversial topic.
- You can't have aligned tables of data / blocks of comments / etc. if group of lines containing the aligned text have different amounts of indentation.
- You can't place a fixed limit on line width (which many code formatting standards do, presumably to reduce horizontal scrolling and facilitate side-by-side diffs).
Brings up my point, people need stop designing languages based on parsing raw text.
And if you don't much care for what format outputs, configure your IDE to display it however you want it to.
Granted, you're hosed if you wrote C for the Linux kernel; you were stuck with 8.
using tabs means everyone else can view the file with as many spaces as they want
using spaces forces everyone else to view the file exactly as you see it