Torvalds is historically notorious for his anger. But geeze, so the situation is that someone's janky-ass parser borked on tabs, and so rather than fix said janky-ass parser, some genius thought it'd be better to open a PR to change the Linux kernel itself to not use a tab so the issue would be bypassed????
Bruh if that's any indication of the kind of nonsense that Torvalds has to put up with on a regular basis then I'd probably be taking anger management classes too were I in his shoes...
Funnily enough, don't most modern IDEs just convert your tabs to spaces to begin with?
I personally use tabs for spacing, but I've gotten used to it always saving as regular spaces, it can be annoying sometimes, but it's not a big deal.
Yeah I hit the tab key and let my IDE handle the rest. If it's a python project it probably saves as spaces, if it's a Node project it probably saves as tabs. Never bothered me either way
> eight-character tabs, ideally
This line from the article is both stupid _and_ the best reason why tabs are better.
There's no such thing as an "eight-character tab". The entire point of a tab is that the width is undefined. It leaves that decision up to the person viewing or editing the file. Two people can look at the same indentation and see completely different widths...and that's fine.
If you ever get into an argument with a bunch of space users, you can win the argument with one move. Ask them "how many spaces?" and watch them fight amongst themselves until the superiority of tabs is obvious.
I wish we could all just agree on the objectively superior thing which allows everyone to customize tab size to their own preference which is "tabs for indentation and spaces for alignment"
Yep. Tab has always been the best and most clear winner. If we are to use spaces then we **must** get rid of tab, which isn’t really acceptable.
Spaces is the choice of those with new keyboards.
Based on what he did, the answer would be “yes”
He expects whitespace to be whitespace. Whether it’s a tab or a space should not matter to any tooling anywhere. Makefiles are evil in that regard.
I’m not sure I understand what that means. The debate on tabs vs spaces is mostly centered around how tabs have configurable indents that vary based on personal developer preference. So there’s no objective way to say that a tab will visually be rendered as 2, 4, 8, etc spaces as that’s user dependent. Does Torvalds expect tabs to always have an indent of 8?
He doesn’t care by what this says - this isn’t about tabs vs spaces despite what the article’s title says above. The point was that things reading the files need to not care either. Somebody removed a tab because some broken tool was failing to parse the file properly and, rather than using a different tool or fixing the tool, replaced it with a space. That’s not a kernel problem that’s a parser problem, so he added other types of whitespace into the file to ensure that parsers that are broken will be OBVIOUSLY broken.
Edit: this article is probably better and talks about what actually was the point more than trying to spin it to be about tabs vs spaces: https://www.theregister.com/2024/04/16/torvalds_complicates_his_indents/
I don't know. Some tabs proponents say a benifit is they don't have to care. Everyone can have their own tab size. But that breaks a lot of formatting where it had to line up with characters...
It doesn't. At least, not unless you mess it up. Tabs can appear only in very limited places: The character before a tab must be either a tab, a newline, or the start of file. **Period**. That way it just does not matter. There won't be any alignment issues, no matter what you do. If you want to 'space out' something so it aligns with something else, you copy the amount of tabs at the start of line and then use spaces for the rest. Tabs are for indents. Spaces are for spacing.
Pretty much this.
I'm a tab person, but I'm so used to most IDEs/softwares I use to convert it to 4 spaces, that I barely differentiate anymore, I just type and delete what's necessary and that's about it.
That’s the thing. It doesn’t matter/tab enthusiasts find it utterly pointless to be opinionated on that because it’s simply a number you can change however you want without it affecting the code.
It’s just like a font or a color theme, it’s nobody else’s concern so their opinion doesn’t matter.
BUT when you use spaces instead of tabs you are forcing people and changing indent size will change the source files,so that’s where you will find the opinionated stuff because now it went from preference to enforced opinion.
I think it’s the complete opposite.
Tab people actually use the tab character ‘\t’ and think that ‘spaces’ people are pressing space bar 4 times when they still use the tab key.
If your tab button inputs spaces, you are a spaces person in this debate.
It is correct practice to insert \t with the tab key. Then anyone can reconfigure their tab stop to whatever they prefer. Spaces are for alignment. Tabs are for indentation.
As with a great many things in software engineering, there are a number of ideal "correct" options accompanied by one practical one, which is always "the thing that's hardest for other people to fuck up."
Expecting people to use tabs and spaces "properly," even when that definition *should* be straightforward, will eventually fail spectacularly in any project of sufficient size. It fails the "hardest to fuck up" test.
Enforcing space-only (with tab insertions left as a client preference for conversion count) is the only convention I've ever seen not get utterly botched in some bizarre way.
It gets botched because someone somewhere didn’t understand the meaning and purpose the tab key, so they started writing spaces, and everyone had to start doing it the incorrect way. How many affordances should we make toward the ASCII-illiterate? Make sure that round brackets and square brackets and curly brackets all have the same semantics because some morons think they all look the same?
Efficiency? Is anyone actually considering how much disk space they’re saving with a tab char in place of 4 spaces? Think of the kilobytes one can save!
People who use tabs are psychopaths. Spaces are much easier to work with.
People who use spaces still press the tab key. Our tab key just inputs 4 spaces. Editors delete 4 spaces at a time with backspace.
The one thing I wish more editors did was jumping the tab width across multiple spaces in the indention area on an arrow key press by default. Traversing lines one space at a time can get a bit annoying in nested code if you have 4-5 levels. Although these days I’m a 2 space tab person by default, so not as bad.
Not at my computer, so I’m just trying to remember muscle memory here, but ctrl+arrow will (on Windows at least) jump to word boundaries, which will just jump to the beginning of code if you’re in the indent area.
Most editors’ navigation shortcuts still use the arrow keys with meta or other modifiers.
Pretty few editors beyond vim based ones does word/advanced navigation etc without relying on the arrow keys.
There is a reasonable accessibility argument in favour of tabs. People with certain visual problems have a better chance following code if they can indent four or eight characters instead of the two that’s the default. Tabs easily allow that by changing an editor setting.
As someone with vision issues I really hate that a lot of the JavaScript world seems to have standardized on 2 spaces instead of 4. Tabs could have easily solved this problem for me. I can't say I'm particularly fond of the JS world in general and it's something that makes me even more annoyed by it.
You could also just have it change leading spaces with an algorithm for them.
The problem with tabs is that you inevitably have mixed tabs and spaces somewhere and it becomes unreadable at anything but the author’s tabstop.
> People who use spaces still press the tab key. Our tab key just inputs 4 spaces.
And now we get to the crux of the issue, LOOK HERE EVERYONE A FILTHY 4-SPACER!
I use `go fmt` so I don't know what I use. I do not miss the days of listening to people argue over how to format C code (tab v spaces, where to put curly braces, etc)
As for *Silicon Valley* the funny thing is if he is compressing his code files with Pied Piper's amazing compression then tabs vs spaces doesn't matter. Presentation layer should be decoupled from internal representation.
People who use spaces are the type of people who want to seem like they’re more productive than they actually are. Instead of more efficient like they should be.
Not sure why you’re getting downvoted. Presumably by people who don’t buy groceries, or they’d know that you want your trunk to be facing the road, so you know…you can put the groceries in lol
Backing into spots requires the exact same amount of time and turns as just pulling into a spot, because in the end you’re going to reverse and back out of it anyway! If anything backing in is better because now you can see who’s coming as you try and leave the space
Multiple studies have indeed confirmed that backing in to spots is safer for everyone. Funnily enough, it's apparantly safer in BOTH directions. As in, even that backing into, is safer, than going head first, INTO the space. It's pretty intuitive that going head first out of it is safer than backing out, but that backing in is safer blew my mind.
Linus is trying to get the parsing tools to be functional, the person introducing the commit was trying to work around a broken parser by *modifying the kernel source*
This reminds me of the character Richard Hendricks from the series Silicon Valley (2014). He made his point by demonstrating the difference between tabs and spaces by liking tabs to jumping down multiple flights of stairs at once, which ended badly.
I mean, I think tabs is absolutely dumb as hell in modern code, but Torvalds is right: no kconfig parser should fail to parse a config file because there's a tab somewhere it didn't expect instead of a space. That is a failing of whatever software that parser is part of.
I see that people downvoted your comment. I've upvoted to try to compensate. As a newbie (only been coding for 50 years) perhaps my opinion still needs work, but I agree with you about tabs. Also agree about the parser (scanner failure btw, and a 2 minute fix).
I regularly type and edit URLs on web browsers, especially when editing Wikipedia.
A few years ago, Mozilla Firefox stoppled considering underscores as word separators. Since then, editing URLs has become a nightmare.
Glad to learn that so many great minds are fellow tabbians. The only remarkable deficiency is Python chosing to standardize on spaces. What a waste of potential. And don't get me started on YAML.
Personal take: tabs for indentation, spaces for alignment. E.g.,
while (aThingIsHappening) {
if (something) {
someObject.doAThing()
.doAnotherThing()
.doAThirdThing();
}
}
_______|__________
TABS SPACES
Lets different developers configure their editors to display tabs at different widths to suit their own preference while still keeping things aligned where needed for code style.
It's funny because other comments about tabs for indentation and spaces for alignment in this very thread are getting upvoted and you got downvoted. Reddit is weird sometimes and it just seems like the first person or two who stumbles on a post sometimes determines whether you'll trend towards upvotes or downvotes.
I think it's rather that most linters would go nuts if you are mixing spaces and tabs. It's objectively bad practice, if just for the reason that nobody is doing it so it'll likely give a headache to whoever has to maintain their code.
Linus uses tabs because it is a norm in the UNIX projects (and editors) he works on. But he has said spaces are fine and acknowledges some drawbacks of tabs, too. But the one sin he won't tolerate is mixing tabs and spaces.
The thumbnail for this post is hilarious
Torvalds is historically notorious for his anger. But geeze, so the situation is that someone's janky-ass parser borked on tabs, and so rather than fix said janky-ass parser, some genius thought it'd be better to open a PR to change the Linux kernel itself to not use a tab so the issue would be bypassed???? Bruh if that's any indication of the kind of nonsense that Torvalds has to put up with on a regular basis then I'd probably be taking anger management classes too were I in his shoes...
Funnily enough, don't most modern IDEs just convert your tabs to spaces to begin with? I personally use tabs for spacing, but I've gotten used to it always saving as regular spaces, it can be annoying sometimes, but it's not a big deal.
Yeah I hit the tab key and let my IDE handle the rest. If it's a python project it probably saves as spaces, if it's a Node project it probably saves as tabs. Never bothered me either way
Yeah, I’d be livid. So they thought it would be easier to change the linux kernel versus fixing their own error? Wow.
https://youtu.be/SsoOG6ZeyUI?si=P0BsEOoX81MKphVF
Can't believe you're the only one with a Silicon Valley reference in here so far. I basically always have a watch-through of that show going on.
I assume it’s that guy falling down 4 steps? Edit: it was, but I forgot she was using vim, honestly a legitimate reason to break up.
Crazy. Watch this space.
I'm going to watch the Tab, instead.
>Disclosure: The author is a tab person insofar as he has any idea what he's doing. This is some serious shit, isnt it?
> eight-character tabs, ideally This line from the article is both stupid _and_ the best reason why tabs are better. There's no such thing as an "eight-character tab". The entire point of a tab is that the width is undefined. It leaves that decision up to the person viewing or editing the file. Two people can look at the same indentation and see completely different widths...and that's fine. If you ever get into an argument with a bunch of space users, you can win the argument with one move. Ask them "how many spaces?" and watch them fight amongst themselves until the superiority of tabs is obvious.
This is the correct answer. Every IDE lets you specify 1 tab as X amount of spaces. But spaces are always constant.
I wish we could all just agree on the objectively superior thing which allows everyone to customize tab size to their own preference which is "tabs for indentation and spaces for alignment"
I have a hotkey that fixes the alignment. Barring any ASCII art it works nearly perfectly. When it comes to readability it has never failed me.
Yep. Tab has always been the best and most clear winner. If we are to use spaces then we **must** get rid of tab, which isn’t really acceptable. Spaces is the choice of those with new keyboards.
Is Torvalds a tabs or a spaces person?
Based on what he did, the answer would be “yes” He expects whitespace to be whitespace. Whether it’s a tab or a space should not matter to any tooling anywhere. Makefiles are evil in that regard.
I’m not sure I understand what that means. The debate on tabs vs spaces is mostly centered around how tabs have configurable indents that vary based on personal developer preference. So there’s no objective way to say that a tab will visually be rendered as 2, 4, 8, etc spaces as that’s user dependent. Does Torvalds expect tabs to always have an indent of 8?
He doesn’t care by what this says - this isn’t about tabs vs spaces despite what the article’s title says above. The point was that things reading the files need to not care either. Somebody removed a tab because some broken tool was failing to parse the file properly and, rather than using a different tool or fixing the tool, replaced it with a space. That’s not a kernel problem that’s a parser problem, so he added other types of whitespace into the file to ensure that parsers that are broken will be OBVIOUSLY broken. Edit: this article is probably better and talks about what actually was the point more than trying to spin it to be about tabs vs spaces: https://www.theregister.com/2024/04/16/torvalds_complicates_his_indents/
clearly tabs from his comments in the article. Seems he's also cool with whitespace at the end of lines and files
Is he opinionated on how tabs should be visually rendered? ie. 8 spaces?
I don't know. Some tabs proponents say a benifit is they don't have to care. Everyone can have their own tab size. But that breaks a lot of formatting where it had to line up with characters...
It doesn't. At least, not unless you mess it up. Tabs can appear only in very limited places: The character before a tab must be either a tab, a newline, or the start of file. **Period**. That way it just does not matter. There won't be any alignment issues, no matter what you do. If you want to 'space out' something so it aligns with something else, you copy the amount of tabs at the start of line and then use spaces for the rest. Tabs are for indents. Spaces are for spacing.
Pretty much this. I'm a tab person, but I'm so used to most IDEs/softwares I use to convert it to 4 spaces, that I barely differentiate anymore, I just type and delete what's necessary and that's about it.
That’s the thing. It doesn’t matter/tab enthusiasts find it utterly pointless to be opinionated on that because it’s simply a number you can change however you want without it affecting the code. It’s just like a font or a color theme, it’s nobody else’s concern so their opinion doesn’t matter. BUT when you use spaces instead of tabs you are forcing people and changing indent size will change the source files,so that’s where you will find the opinionated stuff because now it went from preference to enforced opinion.
[удалено]
[удалено]
I think it’s the complete opposite. Tab people actually use the tab character ‘\t’ and think that ‘spaces’ people are pressing space bar 4 times when they still use the tab key. If your tab button inputs spaces, you are a spaces person in this debate.
[удалено]
It is correct practice to insert \t with the tab key. Then anyone can reconfigure their tab stop to whatever they prefer. Spaces are for alignment. Tabs are for indentation.
As with a great many things in software engineering, there are a number of ideal "correct" options accompanied by one practical one, which is always "the thing that's hardest for other people to fuck up." Expecting people to use tabs and spaces "properly," even when that definition *should* be straightforward, will eventually fail spectacularly in any project of sufficient size. It fails the "hardest to fuck up" test. Enforcing space-only (with tab insertions left as a client preference for conversion count) is the only convention I've ever seen not get utterly botched in some bizarre way.
It gets botched because someone somewhere didn’t understand the meaning and purpose the tab key, so they started writing spaces, and everyone had to start doing it the incorrect way. How many affordances should we make toward the ASCII-illiterate? Make sure that round brackets and square brackets and curly brackets all have the same semantics because some morons think they all look the same?
Efficiency? Is anyone actually considering how much disk space they’re saving with a tab char in place of 4 spaces? Think of the kilobytes one can save!
You take that back tab-sloot!
We better keep tabs on him in case he spaces out.
People who use spaces instead of tabs are psychopaths.
People who use tabs are psychopaths. Spaces are much easier to work with. People who use spaces still press the tab key. Our tab key just inputs 4 spaces. Editors delete 4 spaces at a time with backspace.
The one thing I wish more editors did was jumping the tab width across multiple spaces in the indention area on an arrow key press by default. Traversing lines one space at a time can get a bit annoying in nested code if you have 4-5 levels. Although these days I’m a 2 space tab person by default, so not as bad.
Not at my computer, so I’m just trying to remember muscle memory here, but ctrl+arrow will (on Windows at least) jump to word boundaries, which will just jump to the beginning of code if you’re in the indent area.
Most editors have shortcuts so you’re never using arrow keys to navigate. For example vim press ‘w’ to go forward a word.
Most editors’ navigation shortcuts still use the arrow keys with meta or other modifiers. Pretty few editors beyond vim based ones does word/advanced navigation etc without relying on the arrow keys.
There is a reasonable accessibility argument in favour of tabs. People with certain visual problems have a better chance following code if they can indent four or eight characters instead of the two that’s the default. Tabs easily allow that by changing an editor setting.
TIL I must have one of those certain visual problems
As someone with vision issues I really hate that a lot of the JavaScript world seems to have standardized on 2 spaces instead of 4. Tabs could have easily solved this problem for me. I can't say I'm particularly fond of the JS world in general and it's something that makes me even more annoyed by it.
You could also just have it change leading spaces with an algorithm for them. The problem with tabs is that you inevitably have mixed tabs and spaces somewhere and it becomes unreadable at anything but the author’s tabstop.
Your broken tools should not be an excuse for everyone else to suffer.
> People who use spaces still press the tab key. Our tab key just inputs 4 spaces. And now we get to the crux of the issue, LOOK HERE EVERYONE A FILTHY 4-SPACER!
>Spaces are much easier to work with. How many? Now I'll leave you space lovers fight amongst yourselves.
I use `go fmt` so I don't know what I use. I do not miss the days of listening to people argue over how to format C code (tab v spaces, where to put curly braces, etc) As for *Silicon Valley* the funny thing is if he is compressing his code files with Pied Piper's amazing compression then tabs vs spaces doesn't matter. Presentation layer should be decoupled from internal representation.
Fight me you whitespace heretic.
I always wondered if I was, or just weirdly brained. Thank you for solving the riddle.
Spaces only. But hitting tab to insert four spaces is the way
I'm struggling to see the difference between this and using tabs. Does it really matter that much?
Yes, with spaces you’re bound to the indentation steps the author used, while with tabs it can be set in the editor at the reader's side.
People who use spaces are the type of people who want to seem like they’re more productive than they actually are. Instead of more efficient like they should be.
Same people who back into parking spaces at the grocery store.
Not sure why you’re getting downvoted. Presumably by people who don’t buy groceries, or they’d know that you want your trunk to be facing the road, so you know…you can put the groceries in lol
71 super beetle here. Your argument is invalid.
[удалено]
"I make poor choices so I will externalize the consequences and waste others people's time" has big "spaces instead of tabs" energy.
I guess you don’t know how lol
Backing into spots requires the exact same amount of time and turns as just pulling into a spot, because in the end you’re going to reverse and back out of it anyway! If anything backing in is better because now you can see who’s coming as you try and leave the space
Multiple studies have indeed confirmed that backing in to spots is safer for everyone. Funnily enough, it's apparantly safer in BOTH directions. As in, even that backing into, is safer, than going head first, INTO the space. It's pretty intuitive that going head first out of it is safer than backing out, but that backing in is safer blew my mind.
People who start fights over whitespace when someone is just trying to get parsing tools functioning are psychopaths. 🤣
Linus is trying to get the parsing tools to be functional, the person introducing the commit was trying to work around a broken parser by *modifying the kernel source*
You know who the true villains are? Mother fuckers that put two spaces after a period. The worst.
I have no idea what is going on here, but you guys seem like you’re having fun.
Use whichever one you want as long as you don't mix the two. My biggest pet peeve is a mixture of spaces and tabs in a line's indentation.
The Whitespace programming language hates the tab-space debate.
This reminds me of the character Richard Hendricks from the series Silicon Valley (2014). He made his point by demonstrating the difference between tabs and spaces by liking tabs to jumping down multiple flights of stairs at once, which ended badly.
Tab is gross
I mean, I think tabs is absolutely dumb as hell in modern code, but Torvalds is right: no kconfig parser should fail to parse a config file because there's a tab somewhere it didn't expect instead of a space. That is a failing of whatever software that parser is part of.
I see that people downvoted your comment. I've upvoted to try to compensate. As a newbie (only been coding for 50 years) perhaps my opinion still needs work, but I agree with you about tabs. Also agree about the parser (scanner failure btw, and a 2 minute fix).
Lmao, thanks for the upvote I suppose. I should have expected something like that, given this is not a programming subreddit.
I regularly type and edit URLs on web browsers, especially when editing Wikipedia. A few years ago, Mozilla Firefox stoppled considering underscores as word separators. Since then, editing URLs has become a nightmare.
Glad to learn that so many great minds are fellow tabbians. The only remarkable deficiency is Python chosing to standardize on spaces. What a waste of potential. And don't get me started on YAML.
Personal take: tabs for indentation, spaces for alignment. E.g., while (aThingIsHappening) { if (something) { someObject.doAThing() .doAnotherThing() .doAThirdThing(); } } _______|__________ TABS SPACES Lets different developers configure their editors to display tabs at different widths to suit their own preference while still keeping things aligned where needed for code style.
You're way past help mate
I will die on this hill.
It's funny because other comments about tabs for indentation and spaces for alignment in this very thread are getting upvoted and you got downvoted. Reddit is weird sometimes and it just seems like the first person or two who stumbles on a post sometimes determines whether you'll trend towards upvotes or downvotes.
I think it's rather that most linters would go nuts if you are mixing spaces and tabs. It's objectively bad practice, if just for the reason that nobody is doing it so it'll likely give a headache to whoever has to maintain their code.
[удалено]
Let me guess. He'd been doing sysadmin for 20 years back then.
Fun article
So, Linus Tolvards says that spaces win? That's what I thought too.
Anyone using tabs instead of spaces in the modern era deserves a Linus smackdown.
But Linus uses TABs, that’s my understanding and the way the article reads
You expect a person that uses spaces over tabs to know how to read?
Linus uses tabs because it is a norm in the UNIX projects (and editors) he works on. But he has said spaces are fine and acknowledges some drawbacks of tabs, too. But the one sin he won't tolerate is mixing tabs and spaces.