What is the smallest hill you would die on?
What is the smallest hill you would die on?
What is the smallest hill you would die on?
Code indentation should never use tabs, only spaces.
I don’t understand why this is such a big deal for anyone. With all the UI utilities available it would be incredibly easy to have a setting to interpret 5 consecutive spaces as a tab or a tab as 5 consecutive spaces and just let whoever prefers what to choose how they are going to interface with the code. Hell, you could even make it so 5 is the default and have custom consecutive values as an advanced option in the interpreter for edge cases. So many incredibly more challenging issues have been resolved in IDEs, I just don’t get it.
You've obviously never opened a document (with tabs) where your IDE setting doesn't match what the author used. It looks like shit. Spaces are never, ever, misinterpreted. Tabs are. If your experience in viewing a document depends on a setting that the author had in their IDE, then it is a failure. This is why .PDF files are so ubiquitous, it doesn't matter if you created it in Microsoft Word with a uniform tab setting, or TEX in a console, it looks the same to the reader. If you cannot guarantee that the reader sees your source files as you see them, then you have failed. Full stop. Tabs should be cast into the dust bin as an archaic pre-optimization that failed in the real world.
5!?!? Are you trying to get yourself sectioned?
Reading a tab as however many spaces is trivial, and the point of tabs.
Reading however many spaces as a tab is a gross hack that has to be dialed-in for whatever standard the document chose.
Just use tabs in the first place. God damn. That's what they're for.
I’m on team tab 100% I guess I was saying if someone felt they had to use spaces then they shouldn’t handicap everyone else because of their choice and an interpreter could normalize their code.
I would die on the opposite hill. No spaces, only tabs.
What's your reasoning for liking spaces?
My big reason would be "it hurts readability". That is, when writing code, readibility for others who aren't familiar with it (including future me) is my top-priority, and that means indentation and alignment are HIGHLY important, and if I spend the time to write code with specific indentation and alignment, to make it readable at a glance, I want to be certain that it's always going to display exactly that way. Tabs specifically break that guarantee, because they're subject to editor settings, which means shit like the below example can occur:
I write the following code with an editor that uses a tab size of 4.
cs
myObject.DoSomething( someParameter: "A", someOtherParameter: "B", value: "C");
If someone pulls this up in an editor that uses a tab size of 8, they get...
cs
myObject.DoSomething( someParameter: "A", someOtherParameter: "B", value: "C");
Not really a big deal, in this simple case, but it illustrates the point.
My second reason would be that it makes code more difficult to WRITE, I.E. it's not that hard to insert spaces when you mean to insert tabs, considering that you're not LITERALLY using only tabs just only tabs for indentation and alignment. And if you do accidentally have spaces mixed in, you're not going to be able to tell. The guy on another machine with different editor settings will, though.
I'm aware there are fonts that can make spaces and tabs visible and distinct, but that sounds like a NIGHTMARE to write and read code with. I mentioned above, my top priority is easy readability, and introducing more visual noise to make tabs and spaces distinct can only hurt readability.
Because when I move left in tabs, the cursor isn't clear which tab I'm on. It also tried to sit off the left edge of a terminal in some editors because it aligns with the right side of the character (the tab), instead of the left.
I do see how tabs are a better option : they allow the one editing the file to decide how wide the indentation is. That's actually good User Interface design, by separating the data from the rendering layout.
I can see the argument both ways, but I like to use spaces so the visual and editing interfaces are more standard.
Richard Hendricks would like a word.