Lol.. Yes, also! I don't think that was in my arsenal back then.This is why regex should replace penmanship in the 3rd grade.
You would prefer XML, perhaps?
I don't love YAML. I simply view it as less bad than the other plausible options in a given space, for the most part.
I agree, JSON is overkill and problematic. I haven't seen a compelling reason why YAML is better than stock .properties files.Lowly sysadmin here. Editing JSON files on a virtual console is a nightmare. YAML for all its short comings at least is easy to read and edit outside of an IDE.
Now don't get me started on dealing with an unfamiliar server in which nano is the default editor.
Time to link this again: https://regexcrossword.com/This is why regex should replace penmanship in the 3rd grade.
Spaces are good for giving you RSI (Repetitive Strain Injury), or a muscular spasm akin to Parkinson's Disease, from hitting the space bar all the time.Serious question, what actually are the benefits of using spaces instead of tabs?
The only one I can think of is that it ensures that the reader views the layout of the source code in exactly the same way as the original author intended.
Even then, I’m not entirely sure that has that much value. At least not with the languages I use - which isn’t Python.
Sure, but Emacs key bindings do that anyway.Spaces are good for giving you RSI (Repetitive Strain Injury), or a muscular spasm akin to Parkinson's Disease, from hitting the space bar all the time.
Genuine question. Can you store hierarchical and/or list data in a .properties file? Because in my one exposure to using YAML I ended up with something like:For most application deployments I was just fine with stock .properties file. Couple dozen lines. Super clear what each line was for. No issues with tabs or spaces.
Object1:
- Name1A
- Name1B
- Name1C
- etc
Object2:
- Name2A
- Name2B
- Name2C
- etc
Unlike many popular file formats, there is no RFC for .properties files and specification documents are not always clear, most likely due to the simplicity of the format.
One thing that causes furor in this debate is that is some assumption, basically, that the other side is essentially doing stupid things. I think tabs are better than spaces if people use their tools properly, and I don’t think it is really up for debate, but I also don’t think people who are using spaces are, like, trying to do headstands while typing or something ridiculous.If you're only thinking of indenting to denote scope, then yeah, the tabs people have a point. But scope is not the only reason we indent. Sometimes you want to break a line of code up into multiple lines, and want to align parts of it for readability. Like a function call or definition with many parameters, where you want every parameter on its own line, and want them to all line up.
So a tab person would be forced to use both tabs and spaces to get things to line up. Then the next tab person comes along, who has set their editor to 3-space tabs for some reason, and nothing looks right. But if everyone just uses spaces all the time you never have that issue.
But, I mean, look. The furor of the debate is out of proportion with the size of the harm. Programmers just tend to like things to be just so. It's one of the qualities that make people self-select for programming.
<tabs>var = eqn <spaces> ! Comments
<tabs>longVar+= eqn2<spaces> ! Comments
I just can't understand why someone would want to hit a key sequence 2/4/6/8 times versus ONE time in order to accomplish the same effect. Extra bonus: A decent editor will allow configuration of that spacing for tabs so you can customize it to your preferences. Personally, I'm a tabs person, I have no hate for those who aren't. To quote the kids these days, "You do you, boo." In this context, this really is a personal preference issue, so there is no right or wrong answer.
If everybody followed that convention perfectly, it would be nice enough - but not notably better than just using spaces for most people. Yes, you could configure the depth of your indentation. That's about the only advantage I can see. But Hell is other People, and in no universe will people consistently use tabs without spaces before text, and no tabs in the middle of a line. At the end of the day we're all still stuck relying on pre-commit hooks to unmangle the code.One thing that causes furor in this debate is that is some assumption, basically, that the other side is essentially doing stupid things. I think tabs are better than spaces if people use their tools properly, and I don’t think it is really up for debate, but I also don’t think people who are using spaces are, like, trying to do headstands while typing or something ridiculous.
There isn’t an alignment issue between different tab widths if you use tabs for indenting, and spaces for alignment. The way it works is, you indent with tabs as appropriate for the scope. That all happens on the left side of the row, before you hit any syntax. That’s where tabs go, they are the only thing that goes there, and that’s the only place they go. There aren’t any issues around variables or operators having different widths, because there spaces where tabs and variables go don’t overlap.
<tabs>var = eqn <spaces> ! Comments <tabs>longVar+= eqn2<spaces> ! Comments
As you can see, “tabs” can be any width, there’s no chance of an alignment issue. It gets pretty frustrating to have people describe this apparent problem, which requires us to do something stupid to have it, as if it is a real problem.
Similarly, some tabs supporters think that people are actually hitting spacbar a bunch of times to get the right number of times. I agree with them that tabs are better, but they are incorrect to assume the people using spaces are that stupid. Every ide worth using has the ability to automatically do the space indenting. I assume that is similarly annoying.
having it write regex for you is the single most useful thing an LLM can do for your dayThis is why regex should replace penmanship in the 3rd grade.
At least YAML can have comments. Big plus in my book.YAML is a plague trying to currently strike at every corner of programming and I absolutely HATE it! White space/indent delimited languages are bad enough but who the f*** thought it was a good idea for CONFIG files? What exactly was wrong with JSON? (I get why XML is annoying though)
Tabs allow the programer to visually setup their own visual style, spaces do not. You can setup that a tab be visible as 1 to 8 characters, in a developer text editor.
At least you could schema validate XML and the better toolchains were good at creating & analysing.You would prefer XML, perhaps?
I don't love YAML. I simply view it as less bad than the other plausible options in a given space, for the most part.
That brought back memories of one gig where I had to parse some JSON that was returned by a Cisco REST API. The blob it returned, once parsed, had a parameter that was... a JSON string that I had to parse. In there was another parameter that was a JSON string that I had to parse. In that was the parameter that I actually needed. Yes, that's right: three JSON parses to get at the parameter that I specifically needed to look at.
Whoever wrote the code that returned that abomination deserves to burn in Hell for eternity.
Except 4 character tabs means you might go over the 80 column limit when your code is viewed with 8 character tabs."eight-character tabs"
What's an eight character tab? I was under the impression that it's up to every text editor and any other viewer how many spaces to use to display a tab. I tell VS Code to use 4 spaces for a tab, and I am pretty sure I could get away with that editing kernel code.
Spaces are good for giving you RSI (Repetitive Strain Injury), or a muscular spasm akin to Parkinson's Disease, from hitting the space bar all the time.
It depends on the project kinda, I think. On a proper project with a style guide and code review, just reject any patches that do it wrong.Nobody, nobody is arguing against the tab button. We all like pressing tab to insert a large gap before our text. People who "don't like tabs" don't like the tab character, for various reasons.
If everybody followed that convention perfectly, it would be nice enough - but not notably better than just using spaces for most people. Yes, you could configure the depth of your indentation. That's about the only advantage I can see. But Hell is other People, and in no universe will people consistently use tabs without spaces before text, and no tabs in the middle of a line. At the end of the day we're all still stuck relying on pre-commit hooks to unmangle the code.
IMO, large tabs can be kind of annoying, but they are also good for scanning for these “more than 3 levels of indenting” messes, which need inspection, so having them flexible is really nice.Rationale: The whole idea behind indentation is to clearly define where a block of control starts and ends. Especially when you’ve been looking at your screen for 20 straight hours, you’ll find it a lot easier to see how the indentation works if you have large indentations.
Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you’re screwed anyway, and should fix your program.
This is fun, but why do the letters move around after you solve a puzzle? It bothers me.Time to link this again: https://regexcrossword.com/
That style looks very weird to me in that it makes it seem as if INNER and JOIN are separate things, and that it puts ON and AND on the same level as INNER JOIN and WHERE.SQL:
Code:SELECT u.id, u.name, u.email FROM users AS u INNER JOIN address AS a ON u.id = a.user_id WHERE a.state='CA' AND a.country='USA' ORDER BY u.id ;
What is wrong with that? I happen to have written SQL over the last 30 years with that same convention. And where did I learn that 30 years ago? The Oracle and IBM DB-2 manuals.
SELECT u.id, u.name, u.email
FROM users AS u
INNER JOIN address AS a
ON u.id = a.user_id
WHERE
a.state = 'CA'
AND a.country = 'USA'
ORDER BY u.id
;

Well, I haven't coded assembly in about 30 years. But my favorite project was on the C-64.Greetings friend. On behalf of my brothers and sisters, I invite you to the church of assembly language.
We care not for curly braces or significant whitespace, or tabs vs spaces. We do wear cowled robes, eat raw red meat, and write witheringly fast code.
Sure, you'll probably never finish another project for the rest of your life but you'll get to brag about how fast it would be if you did.
Kidding aside, I hope the tabbers and the spacers will find peace and harmony. If we can't solve that one, what hope do we have for the world's more substantial problems?
There isn’t an alignment issue between different tab widths if you use tabs for indenting, and spaces for alignment. The way it works is, you indent with tabs as appropriate for the scope. That all happens on the left side of the row, before you hit any syntax. That’s where tabs go, they are the only thing that goes there, and that’s the only place they go. There aren’t any issues around variables or operators having different widths, because there spaces where tabs and variables go don’t overlap.
<tabs>var = eqn <spaces> ! Comments <tabs>longVar+= eqn2<spaces> ! Comments
As you can see, “tabs” can be any width, there’s no chance of an alignment issue. It gets pretty frustrating to have people describe this apparent problem, which requires us to do something stupid to have it, as if it is a real problem.
<tabs>foo = myfun(z * (17 * x +
<tabs> 13 * y));
<tabs>var<tab>=<tab>eqn<tab>! Comments <tabs>longVar<tab>+=<tab>eqn2<tab>! Comments
... and the tab spacing grows so columns on adjacent lines line up (which saves a lot of messing about when you get reallyLongVar added on a third line). Especially useful if you're writing assembly and want the operand arguments aligned. A real shame they're not more widespread.
Similarly, some tabs supporters think that people are actually hitting spacebar a bunch of times to get the right number of times. I agree with them that tabs are better, but they are incorrect to assume the people using spaces are that stupid. Every ide worth using has the ability to automatically do the space indenting. I assume that is similarly annoying.
Yes, that's just crazy. Hit tab once, or not at all if you find that less annoying to undo unnecessary indents when the IDE gets it wrong.
It's a throw-away bit in the diner scene in the original Back to the Future.
Sorry, I am late for the fight, but...
Spaces FTW!
The movie is called Spaceballs after all - and not Tabballs! q.e.d.
Someone who understands the importance of readability -- and that fixed-width fonts are less readable. That's why books, newspapers and this website use proportionally-spaced fonts.What kind of maniac uses a proportional font to write code?
The Linux command “column” can do something like the elastic tab stop you’ve described, I think, if you pass it the -t argument it’ll look at all your columns and pick a column width so that they fit tidily. These aren’t really tabs though (although you could tell it that the column separator is the tab character).Unfortunately until you use some kind of tool (such as diff variants) that put anything at the start of the line which may or may not be wider than a tab.
It would certainly change the configuration I've generally met in tools. Particularly:
<tabs>foo = myfun(z * (17 * x + <tabs> 13 * y));
...where I can hit tab once on the second line and get indented to match the opening parenthesis - but I certainly wouldn't rely on all my tools being set up to distinguish spaces from tabs when doing so.
For what it's worth, the elastic tabstops I've been mentioning in these comments let you write:
I'll disagree with you there. Proportional fonts may make natural language more readable, but I've found they make machine languages deceptively more readable i.e. my brain is more likely to interpret something which is not quite a natural-language word in the code as something other than what is actually written.Someone who understands the importance of readability -- and that fixed-width fonts are less readable. That's why books, newspapers and this website use proportionally-spaced fonts.
Sure, it's not such a big deal if all your variable names are one or two characters -- but it's not the 20th century any more: use proper meaningful names for variables, clases etc. And write decent comments. All these things mean you need a more readable font.
Proportional fonts are intended to make reading comfortable not necessarily super legible. How many Ls and how man Is are in the line below? Answer fast!Someone who understands the importance of readability -- and that fixed-width fonts are less readable. That's why books, newspapers and this website use proportionally-spaced fonts.
Sure, it's not such a big deal if all your variable names are one or two characters -- but it's not the 20th century any more: use proper meaningful names for variables, clases etc. And write decent comments. All these things mean you need a more readable font.
You should really help out people who are using spaces to do their aligning by hand. They seem to have trouble with it. Whenever you see a project that uses spaces, run something like:I'm so dedicated to tabs that I actually write all my code in a spreadsheet, and then copy/paste it to a text editor before compilation!![]()
cat whatever.c | tr -s ‘ ‘ | column -t > tmp
mv tmp whatever.c
git commit -a -m “finally everything is aligned with spaces”
git pushThat's one big problem I have with tabs: if you want to align things vertically or have a fixed max line length, tabs aren't consistent and introduce unnecessary variability.The key reason I switched to (and like) tabs is that it separates the content from the presentation.
As in, I can set the tab size on my editor to whatever number looks great for me (which is 2) - meanwhile others can set it to whatever number looks great for them.
[edit] I lied. I just checked and must have switched my tab size to 4 some years ago. Thankfully I don’t need to go back and update all my old code.
Actually EMACS was all the rage for a time until Clifford Stoll found that notorious hole. Long live VI and “set -o vi“ for command retrieval. Try this: barbecue sauce, ham, 1/4 Muenster, 3/4 Pepper Jack, pineapple and snippets of green onion.I too am a filthy tabs person. And I prefer vi over emacs (though these days nano is common). I also put pineapple on pizza.
If the inability to distinguish between I and l is a huge problem for the project l think something much deeper is wrong.Proportional fonts are intended to make reading comfortable not necessarily super legible. How many Ls and how man Is are in the line below? Answer fast!
lIlIIl