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.
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.
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
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.
So your work provides Gemini to help you, and you ask it existential questions instead of pasting the borked file in so it could spit it back to you fixed in 30 seconds?
It was not able to determine which lines in the file needed to be corrected. That’s part of what lead me to ask it “existential” questions.
I use tabs. 👍
Then we may be friends!
Wrong
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.
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.
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!
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).
Everything that doesn’t align with my subjective, personal mental model is stupid. 😭
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.
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.
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?
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.
With tab you end up with two. Unless you write if<tab>(foo<tab>==<tab>bar)<tab>{ <tab>…
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.
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.
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.
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.
Tabs for indentation / Spaces for alignment
i fought against tabs for years because I figured one character vs four will decrease file size (I’m old enough to remember a time when that mattered) but eventually gave up to spaces as I started working with more and more collaborators and found consistency to be more important than a few bytes. now if only we can solve line endings.
I think you made a typo
You have validated my sanity, thank you.
Maybe I’m confused, but it seems like you used to dislike tabs, but now dislike tabs?
I think like is too strong a word in this case. Consistency is key and fighting the tide, even if it is not the best solution, is foolish.
I have worked on projects that get run through automatic formatting when committed to repos
Perhaps you need something like that and you can auto format the way you want on the way out
Automatic code formatting, and failing a PR due to an automatic formatter is lazy and wrong. Code formatting should be a (strong) set of guidelines, but never a hard and fast rule. Every code base ends up with some section that is visually easier to understand but breaks the formatting check.
deleted by creator
Git has post-checkout and pre-commit hooks that can easily do this.
Means your local copy is in your style, but you commit in the repo style.
Insane thing to do, but nobody’s stopping you…
Or people could do the logical thing and just use tabs.
edit: remove extra space.
My text editor will use spaces if it is in the liter file or how it auto detects in yaml files etc
The experience is no different when using tab / shift+tab
The experience of entering the text isn’t the part to which I object.
Claiming that spaces as indentation are functionally equivalent to tabs is what inspires my objection.
I don’t think you gave an example in your original post as how tabs would have solved your problem, and dealing with yaml a lot myself I can’t imagine exactly what may have happened besides incorrect indentation
I get rich errors with yaml language server and I configure it with spec files for kubernetes manifests so it tells me exactly where my issues are
Easy solution, use only a single space for each level of indentation.
/s, probably. Though one could make an editor expand the single spaces at the start of a line to an arbitrary width, for readability.
A single space shown by the editor at an arbitrary width is basically what a tab is lol.
Exactly, so why two different character codes? :-P
I approve of your existence based solely on this comment.
You should create an elaborate set of tiles making your case and attach them to the asphalt on roads to convince folks to switch.
Burma Shave!
Maybe I will do so in Philadelphia!
Richard Hendricks won me over
It’s an issue with Yaml, not the spaces though. Also “fork” bombs, impossible to implement properly, the Norway problem, etc.
Spaces themselves are not problematic. They seem to do their job fairly well. Their job, however, is not indentation.










