Number of spaces in a tab is not universal. Different editors have different defaults. If you have a dozen programmers with 8 editors and everyone using their editor default for tabs it is havok.
That's why most larger projects have coding standards. Also many projects include an ".editorconfig" file in their git repository to simplify the adoption of tab/space standards. https://editorconfig.org/
Was this really a serious question? Seems like OP may have taken a Silicon Valley episode too seriously.
Yes they do. The issue doesn't really exist anymore. Languages formatters will fix up formatting regardless of environment and user preferences.
I think this was a issue back with dumb source control and comparison tools. I remember looking at source safe or svn history files trying to figure out what code actually changed because the diff tools at the time were too dumb to ignore whitespace changes. I was also a new developer back then and part of the too dumb bit of the equation. Actually I do not even remember for sure if I had a diff tool or it was just good ol mark1 eyeball. I do remember a couple senior devs kept switching parts of the code base between their preferred formats. Ugh this is coming up on 20 years ago.
Editor's and tools have come a long way. Developers are pretty much the same though.
I can set VIM (and most any other editor worth its salt) to "replace" a tab with a certain number of spaces.
I can't set ANY editor to logically replace 4 spaces with a tab.
When working on code with a group, it's best to default to spaces. This way tab-people can set their editors to replace with spaces, and space people can just do their thing. You CAN'T do that in the opposite direction.
Align the equal characters. Would you make it: variable, some amount of tabs, =, value? If you're going to use spaces there, why not use them at the start of lines too?
I used tabs for about 20 years. But a couple of years ago I realized that that is wrong, and so I switched!. Also switched from rendering tabs as 4 spaces to using 2 literal spaces.
15 comments
0 u/shillaccount3344 02 Oct 2019 04:09
For absolute control of the formatting!
0 u/TuxInATornado 02 Oct 2019 04:13
Number of spaces in a tab is not universal. Different editors have different defaults. If you have a dozen programmers with 8 editors and everyone using their editor default for tabs it is havok.
4 spaces is 4 spaces.
0 u/albeit 02 Oct 2019 08:04
That's why most larger projects have coding standards. Also many projects include an ".editorconfig" file in their git repository to simplify the adoption of tab/space standards. https://editorconfig.org/
Was this really a serious question? Seems like OP may have taken a Silicon Valley episode too seriously.
0 u/TuxInATornado 02 Oct 2019 10:08
Yes they do. The issue doesn't really exist anymore. Languages formatters will fix up formatting regardless of environment and user preferences.
I think this was a issue back with dumb source control and comparison tools. I remember looking at source safe or svn history files trying to figure out what code actually changed because the diff tools at the time were too dumb to ignore whitespace changes. I was also a new developer back then and part of the too dumb bit of the equation. Actually I do not even remember for sure if I had a diff tool or it was just good ol mark1 eyeball. I do remember a couple senior devs kept switching parts of the code base between their preferred formats. Ugh this is coming up on 20 years ago.
Editor's and tools have come a long way. Developers are pretty much the same though.
0 u/Fuckle_Chucks 02 Oct 2019 04:41
If I need to quickly create a one-off document (especially for printing) spaces are much easier than tabs.
0 u/theNakedNecromancer 02 Oct 2019 05:11
I can set VIM (and most any other editor worth its salt) to "replace" a tab with a certain number of spaces.
I can't set ANY editor to logically replace 4 spaces with a tab.
When working on code with a group, it's best to default to spaces. This way tab-people can set their editors to replace with spaces, and space people can just do their thing. You CAN'T do that in the opposite direction.
0 u/UsedToBeCujoQuarrel 02 Oct 2019 06:26
I think there is a way to get EMACs to do space->tab replacement automatically. Vague memory.
0 u/libman 02 Oct 2019 23:20
Ew, Emacs... Worse than pedophilia!
0 u/UsedToBeCujoQuarrel 02 Oct 2019 23:47
Editor of the gods!!!
0 u/J_Darnley 02 Oct 2019 08:54
How do you vertically align things over multiple lines with tabs?
Align the equal characters. Would you make it: variable, some amount of tabs, =, value? If you're going to use spaces there, why not use them at the start of lines too?
0 u/user9713 [OP] 02 Oct 2019 15:28
This is what I do (sorry that it's tough to see the mouse cursor)
https://files.catbox.moe/u8vw9s.gif
0 u/menstreusel 02 Oct 2019 19:53
Spaces. Python taught me to love them!
0 u/user9713 [OP] 02 Oct 2019 23:53
I'm interested to know why.
I use Python quite a bit (programming is a hobby for me, though).
I actually never noticed the debate between Spaces and Tabs until I got ESLint running on VSCode and all those red squiggly lines popped up.
0 u/libman 02 Oct 2019 23:14
I used tabs for about 20 years. But a couple of years ago I realized that that is wrong, and so I switched!. Also switched from rendering tabs as 4 spaces to using 2 literal spaces.
I thank the awesome Nim programming language and its style guide for helping me see the light. It will actually refuse to compile if you use a tab!
0 u/user9713 [OP] 02 Oct 2019 23:35
This is hilarious; I can't tell if you're serious 😂
Anyway, that's pretty fucked up that the compiler enforces an indentation type.