It is SO STUPID that spaces are widely preferred for indentation in code.
For the past, I don’t know, two hours I’ve been trying to fix YAML formatting issues that could have been fixed without any human intervention if only tabs were used. (It’s a big file, hence the duration.) (I know YAML doesn’t support tabs. That’s kind of my point.)
I even reluctantly asked Gemini (forced upon me by work; I was hoping it would change my mind in this case) why anyone would prefer spaces. It said the same irrelevant thing most people say: because some tools don’t support tabs properly.
Know what that sounds like to me? A problem with the fucking tool.
I don’t know if this is the right place to post this, but I can’t think of a better option.
I used spaces by convention for many years because my peers did and I didn’t have a solid reason not to.
Then I read a post on reddit from a visually impaired man who was lamenting that his dev workflow involved opening a file, changing all the spaces from 2-width to 8-width (I think), doing his edit, and then converting back to 2-width. All because 2 was the convention his peers insisted on and he could not visually distinguish with that indentation level.
I switched to tabs that day, set my editor to represent them as the width of two spaces, and never looked back. It was, and still is, the only objective argument I have ever heard on the topic from either side, and accessibility is important to me.
After several years, using tabs for indentation (followed by spaces for alignment when it makes sense) has never once caused me an issue; and even a slim chance that it may make my code easier for someone else to navigate is good enough for me.
See, everyone else? This person is proving my point!
The good reason I’ve heard is because it’s consistent. Tabs can change length depending on what’s displaying it (this is both a feature and an issue). Spaces will mostly be consistent.
However, you say the issue is with the tool, and I agree, but in a more complex way. A good tool won’t really care which you use. A good tool can interpret them identically and adjust the display to your preference. Bad tools are why people will have a preference for one or the other, and the above is the good argument for (and also against) spaces instead of tabs.
100% Whitespace should not be a funtional element of a language. Let me format it however looks best to me then just end the line with a ;
I loathe YAML (and Python for that matter). Anything that uses whitespace as syntax is a problem. The exception is Whitespace, it gets a pass for being hilarious.
I couldn’t agree more with you though - it’s a problem with the tool. If it doesn’t support tabs that’s not my problem, and if the language used whitespace for style instead of syntax everything would still work fine.
Whitespace sensitive is devils handiwork, tabs vs soaces is simply making that evident.
The classic programming holy war. As far as code is concerned, just have a formatter for the language, whichever tabs or spaces the formatter uses. I just hit tab and let the formatter decide. I most use Rust and I honestly had to lookup if rustfmt used tabs or spaces because I honestly didn’t remember.
As for the YAML part, that’s just because YAML sucks
I just forget about it because my editor changes my tabs to spaces so I usually hit the tab key anyway. Would prefer tabs, but it is what it is.
but it is what it is
Since LLM’s the only devs left are those with this mindset and I hate it.
[React won] but it is what it is
[Liquid Ass] but it is what it is
[LLMs] but it is what it is
[PHP lost its simplicity] but it is what it is
What if… we invented a character with the sole purpose of delimiting indentation?
People could even configure whatever width makes sense to them locally. We could call it fabulations with how fabulous it would be.Doesn’t that already exist? It’s called linefeed or something like that
Ya got wooshed mate
Did they? Because a line feed moves to the next line at the same column (unless you’re on windows where it’s just a carrage return again).
Seems likely someone here got wooshed, though.
That’s not really what’s described by “delimiting” and especially not by “configuring the width”. Which are features of tabulations.
And it’s Linux where line feed is carriage return and line feed together (down a line and back to the start) while Windows separates those and is historically consistent (although that’s been clunky for a long time).
I knew someone was going to reference this. It’s surprising that it took so long.
One tab, save ya EIGHT spaces!
No.
Wanting two different white space characters that are indistinguishable from each other, when a single one will do, is stupid.
Also, YAML is stupid, as is every language that chooses to use whitespace as a delimiter (fight me python nerds).
I agree on indentation as delimiter being stupid for a PROGRAMMING language, but for markup/data serialisation languages that are primarily meant to be human readable, it is a great solution.
Syntax can be your delimiter, and white space done how the human sees fit. That’s the proper solution, imo
Yeah well you’re wrong.
Braces help everyone, just like punctuation does. Try and read a Cormack McCarthy novel and the importance of punctuation to denote structure for readability will become immediately apparent.
Using whitespace as a delimiter is just nerds min maxing too far.
Yeah well you’re wrong.
Relax, this is clearly a subjective matter.
Lemmy is a niche of a niche. People can’t relax around here.
Some people are just so incredibly “AKQCSHUALLY” about certain things. And they don’t even see that there’s no right or wrong, it’s just your use case vs mine. Narrow-minded af.
PEOPLE CAN’T RELAX???
I don’t know, I’ve never found Python structure remotely hard to read
Except when some chucklehead used two character intents. This is why tabs are superior; if you want to be squinty, be squinty. The rest of us get 8 char intents that make the logic easy to see.
A novel by definition isn’t a data structure meant for serialisation. Your argument is akin to going up to a mapmaker and telling them do to their job different because van Gogh did it different and look how his art turned out!
Braces in a data structure help nobody but computers. That’s why I specified that for HUMAN READABILITY, YAML is superior to JSON, even though they easily translate between each other. Try to read a single-line, optimised for transport JSON vs try to read a neatly formatted YAML document. YAML is inherently closer to how humans perceive data.
Everything that doesn’t align with my subjective, personal mental model is stupid. 😭
I agree having two is stupid. That’s why it should be a tab instead of multiple spaces.
The indentation doesn’t even get parsed. It’s just there for human readability.
Haaave you met python?
With tab you end up with two. Unless you write if<tab>(foo<tab>==<tab>bar)<tab>{ <tab>…
If it’s just there for readability then don’t have two characters that can be interpreted differently.
Your text editor / viewer is capable of entering two spaces when you hit tab.
❤️ Python! But letting me program is stupid and a bad idea. So it works. Deal with it 🤣
Python nerd here, willing to fight.
Easy language, simple script, faster learning, faster writing, better person, superior language.
Also currently trying to write english as concise as Python to ration my brainpower, you can thank my huge brain later when I do epic things like saving the world with whitespace delimiters.
Well, I haven’t used this account in almost a year, but apparently when I did I tagged you as “Epic apologist.”
So an incorrect take from you makes sense!
I do agree that YAML is stupid, though.
edit: Apparently I have used this account more recently than a year ago, but only sparsely. I apologize for misleading you.
Lmfao, imagine bragging that you need to put people into buckets so you can dismiss them.
Learn how to use your brain and respond to the argument at hand.
Based on this conversation, I’ve added a tag, “space lover”.
It’s too late for you, I have already won. Also, username checks out.
The username is coincidentally entirely unrelated … I hadn’t even noticed the relevance lol
Hah, all right, this could be fun.
At no point did I brag. Presenting facts about myself as bragging says more about you than it does me. You complaining about that, doubly so.
I’m not putting you in a bucket so far as I can tell. I used a function of my Lemmy client to identify you. Epic is a bad storefront and Tim Sweeney seems to be a bad person; certainly he was actively anti Linux until it impacted his bottom line. I disapprove of that because I support Linux and also think morals should account for things other than, well, accounts.
It’s possible I’m wrong, in which case I welcome debate, but I didn’t get here without using my brain. Also, I was trying to be funny with my initial response; if you used your brain, you would recognize that.
Ultimately, I don’t like you. Not because I disagree with you - I can handle that - but because you’re rude. Which I can also handle, but still don’t like.
The irony of someone labelling people and then bringing up those labels in unrelated conversations to dismiss them, and yet still having the audacity to call others “rude”.
Look in a mirror bud.
Is your entire objection to me that I tagged you? You didn’t address any of my other points. I’m willing to discard your Epic affinity if you want to talk about anything else.
You made no points about tabs and spaces, you brought up an unrelated conversation, then somehow convinced yourself I was the dick in the situation.
Well, fair enough about me not referencing the original point. I was quite mad (for largely unrelated reasons) when I made the original post, then when you responded, I was trying to be funny rather than helpful.
I did reference an Epic conversation. Perhaps that was unhelpful. I didn’t expect the conversation to gain sufficient length that it would matter. I apologize, I was working more towards humorous than helpful.
However, I made all of my points about tabs being superior in my original post or other comments. I wasn’t trying to obfuscate things in further comments.
Who tf is using spaces
Unix.
We have a 40+ year old software (still developed, but some stuff never changed). They have the software read tables from space separated files. They trouble is each line has to line up with columns above it, so if you have a long string in one row, you have to go to every single line and space them with empty space to all line up the same.
To make it even worse it was based on 80 character max, so if your column headers are more than 80, you create a second line with more column headers. So row 1 is your columns, row 2 is your next set of columns. Row 3 are spaced entries to line up with row 1. Row 4 are spaced entries to line up with row 2.
And word wrap dosnt work because column rows have a CR after them.
Its a freaking nightmare. This is why tabs are better
You can probably commiserate with the Japanese postal CSV, some of whose horror is captured here: https://www.dampfkraft.com/posuto.html
Oh, god. Humans did this formatting abomination twice?
Japan and IT have an … Interesting relationship. If you can code, looking at parsing libraries can be interesting. There are all kinds of csv-ish abominations here. Multiple header rows, different headers if a line is empty, etc.
That sounds like a simple problem that could safely be fixed in a day or days depending on the size of the data set, with a high degree of confidence.
Unfortunately its tied into the code and appa that compile those tables. And they need to support legacy customers who’ve built on top of that system. The software still opens files from that era to support aerospace customers who have a database of parts from that era.
Why can’t you make it work with another format, and use a flag for legacy format for those clients. Then you don’t have to deal with it as much
I wish we could. I had hoped they’d move to CSV at least. Newer parts of the software support excel files.
I assume Its feeding into a legacy codebase that they obviously don’t want to touch because it works and supports auto and aerospace across the globe. And many places still use data they generated in the 70s.
The whole thing is terrible to work with, thankfully AI is great at converting simple formating to convoluted bullshit formatting.
I too prefer tabs. It’s always been that way. It annoys me when an editor tries to be smart with spaces, and insert auto indentation instead of an actual tab character. It annoys me even more when I press the tab key, and the editor interprets that as “I guess that means you want spaces.”.
I will concede that tabs can be a bit too wide when you end up nesting a bunch of stuff, so I’m fine with them being displayed as a set of spaces, but when I hit tab, I want an actual tab character. Otherwise I would use the spacebar.
Most editors I’ve used let you set a tab width in units of spaces. I prefer tabs at a width of two spaces. That’s the great thing about tabs though, we can all share the same codebase and set the tab width to whatever we each desire
That’s my whole point!
I will concede that tabs can be a bit too wide when you end up nesting a bunch of stuff
Nope, that’s a code smell; if your code is veering off into the rhubarb because you’re nesting like crazy then that’s a signal to break up your function. 8 char tabs help you code better.
Tabs for indentation / Spaces for alignment
tabs have never been a consistant thing. its basically just a certain amount of spaces. I can totally see why tabs would not be used.
Exactly, and by design: each user is allowed to set their own tab width and not mess everyone else up.
Like 8 space tabs? Go for it.
Want only 2-space indents? Just update your settings.
The semantic mean of a tab is “indent” - it should be up to each user what their idea of an appropriate indent width is.
I used to like you because of your username, but that ended today.
so be it.
Surely, as a human, you can work with me and recognize that the thing about tabs is that they can be adjusted to represent whatever number of spaces you like? The thing about spaces is that two spaces will always be two spaces wide. What benefit does that provide?
I mean I feel your arguing against yourself here. its more precise to specify using a space or two spaces or three spaces, etc. like in python the formatting is the structure becasue it does not use brackets and such. File formats are exactly like they sound. specific formats. consistancy is paramount.
I acknowledge that consistency is beneficial, but Python works with both tabs and spaces. The difference, in this context, is that if you like two spaces for indentation, but I like four, your code will always have sections of two when I look at it. I can make configurations that change it and so can you, but why is that needed?
Meanwhile, in this hypothetical, if we were to use tabs, you could set your tab to represent two spaces and I could set mine to represent four and we’d both be happy with the same, unchanged code.
yeah I see what you are saying but again I can see why consistancy would be given priority.
Consistency in how many indents used is very important.
Consistency in how many pixels that indentation takes up on the screen between two users is completely irrelevant.
Tabs give you consistency and simplicity, one tab per indent. We each decide how we want them to look on our screens and it doesnt matter if they don’t look exactly the same.
What you probably mean though is alignment, which is not indentation. Tabs to indent, followed by spaces to align, gives every user the same alignment no matter what their tab-width is set to.
The kind of coding I do is amateur hour at best and I use tabs instead of spaces
It’s neater and (for the kinds of stuff I do) works
Also makes finding my errors easier
Sounds like you’re doing it right, regardless of what style guides say.












