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.

top 99 comments

sorted by: hot top controversial new old
[–] 18 points 1 month ago

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

  • source
  • [–] 18 points 1 month ago (2 children)

    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.

  • source
  • hideshow 2 child comments
  • [–] 17 points 1 month ago (7 children)

    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

  • source
  • hideshow 7 child comments
  • [–] 9 points 1 month ago (2 children)

    You can probably commiserate with the Japanese postal CSV, some of whose horror is captured here: https://www.dampfkraft.com/posuto.html

  • source
  • parent
  • hideshow 2 child comments
  • [–] 4 points 1 month ago (3 children)

    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.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 1 month ago (2 children)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 1 month ago (1 child)

    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

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 1 month ago

    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.

  • source
  • parent
  • [–] 16 points 1 month ago (1 child)

    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.

  • source
  • hideshow 1 child comment
  • [–] 16 points 1 month ago (3 children)

    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.

  • source
  • hideshow 3 child comments
  • [–] 6 points 1 month ago

    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.

  • source
  • parent
  • [+] 17 points 1 month ago* (last edited 1 month ago) (1 child)
  • [–] 17 points 1 month ago

    Tabs for indentation / Spaces for alignment

  • source
  • [–] 8 points 1 month ago (1 child)

    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

  • source
  • hideshow 1 child comment
  • [–] 7 points 1 month ago (2 children)
  • [–] 6 points 1 month ago

    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.

  • source
  • [–] 14 points 1 month ago (7 children)

    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.

  • source
  • hideshow 7 child comments
  • [–] 16 points 1 month ago

    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.

  • source
  • parent
  • [–] [S] 1 point 1 month ago (5 children)

    I used to like you because of your username, but that ended today.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 6 points 1 month ago (4 children)
  • [–] [S] 1 point 1 month ago (3 children)

    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?

  • source
  • parent
  • hideshow 3 child comments
  • [–] 4 points 1 month ago (2 children)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 5 points 1 month ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 10 points 1 month ago

    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 ;

  • source
  • [–] 5 points 1 month ago (6 children)

    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.

  • source
  • hideshow 6 child comments
  • [–] [S] 7 points 1 month ago (2 children)

    Maybe I'm confused, but it seems like you used to dislike tabs, but now dislike tabs?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 5 points 1 month ago (6 children)

    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

  • source
  • hideshow 6 child comments
  • [–] 2 points 1 month ago (4 children)

    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...

  • source
  • parent
  • hideshow 4 child comments
  • [–] [S] 2 points 1 month ago* (last edited 1 month ago) (3 children)

    Or people could do the logical thing and just use tabs.

    edit: remove extra space.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 1 month ago (2 children)

    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

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 1 point 1 month ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 1 point 1 month ago

    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

  • source
  • parent
  • 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.

  • source
  • parent
  • [–] 40 points 1 month ago* (31 children)

    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).

  • source
  • hideshow 31 child comments
  • [–] 20 points 1 month ago (9 children)

    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.

  • source
  • parent
  • hideshow 9 child comments
  • [–] 6 points 1 month ago* (7 children)

    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.

  • source
  • parent
  • hideshow 7 child comments
  • [–] 5 points 1 month ago (3 children)

    Yeah well you're wrong.

    Relax, this is clearly a subjective matter.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 6 points 1 month ago (2 children)

    Lemmy is a niche of a niche. People can't relax around here.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 1 month ago

    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.

  • source
  • parent
  • [–] 8 points 1 month ago (3 children)

    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.

  • source
  • parent
  • hideshow 3 child comments
  • [–] [S] 2 points 1 month ago* (last edited 1 month ago) (12 children)

    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.

  • source
  • parent
  • hideshow 12 child comments
  • [–] -5 points 1 month ago* (11 children)

    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.

  • source
  • parent
  • hideshow 11 child comments
  • [–] [S] 4 points 1 month ago (8 children)

    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.

  • source
  • parent
  • hideshow 8 child comments
  • [–] -1 points 1 month ago* (last edited 1 month ago) (7 children)

    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.

  • source
  • parent
  • hideshow 7 child comments
  • [–] [S] 3 points 1 month ago (6 children)

    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.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 2 points 1 month ago (5 children)

    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.

  • source
  • parent
  • hideshow 5 child comments
  • [–] [S] 1 point 1 month ago (4 children)

    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.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 1 point 1 month ago (3 children)

    Maybe I should slap a label on you based on your behaviour in this one conversation and dismiss everything you have to say forever because of that, that seem reasonable to you?

    The labelling feature existing in the client doesn’t mean you have to use it. It’s a fundamentally toxic form of interaction that people don’t do irl for a reason. People can be in bad moods, people can change, and people can be convinced and have their thoughts and beliefs shift. Slapping a label on them and ignoring what they have to say is intellectual laziness that just creates an even stricter filter bubble around you.

  • source
  • parent
  • hideshow 3 child comments
  • [–] [S] 1 point 1 month ago (2 children)

    Well, my tag on you is "Epic apologist." That's something I consider a negative. I can see how you would object to that and don't mean to represent your opinion as invalid, just differing from mine. I wanted to recognize that about you in the future. If you've changed your mind, let me know and I'll remove the tag. I don't deny that people's moods can vary.

    I have lots of tags on lots of users. For example, I have someone tagged as "construction worker with a camera" because they described themselves as such. How is that "fundamentally toxic"?

    If I could tag people in real life, I absolutely would. I think both I and at least potentially they would benefit from that, especially if it were reciprocal.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 1 month ago* (last edited 1 month ago) (1 child)

    Well, my tag on you is "Epic apologist." That's something I consider a negative. I can see how you would object to that and don't mean to represent your opinion as invalid, just differing from mine.

    Lmfao, ok bud. You can't see how that's toxic?

    You've literally proven in this very conversation how that is toxic. You just used your previous arbitrary labels of epic apologist to dismiss what I had to say without considering it.

    It is intellectually lazy, and overconfident.

    I'm wiser now than I was 5 years ago, why would I trust a label that my self from 5 years ago slapped on someone? How do I know I wasn't just in a bad mood when I did that and was mistaken? How do I know that conversation was even completely representative of that person's views and not just a blip?

    You are taking a small snapshot of someone's views (a single conversation), then boiling that down to a psnarky label that you apply to them forever.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 1 month ago (1 child)

    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.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 1 month ago (1 child)
  • [–] 3 points 1 month ago (2 children)

    You should create an elaborate set of tiles making your case and attach them to the asphalt on roads to convince folks to switch.

  • source
  • hideshow 2 child comments
  • [–] 5 points 1 month ago (1 child)
  • [–] 5 points 1 month ago (1 child)

    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.

  • source
  • hideshow 1 child comment
  • [–] 1 point 1 month ago* (last edited 1 month ago)

    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

  • source
  • parent
  • [–] 2 points 1 month ago

    Richard Hendricks won me over

  • source
  • [–] 2 points 1 month ago (3 children)

    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.

  • source
  • hideshow 3 child comments
  • [–] 2 points 1 month ago (1 child)

    It's an issue with Yaml, not the spaces though. Also "fork" bombs, impossible to implement properly, the Norway problem, etc.

  • source
  • hideshow 1 child comment
  • load more comments
    view more: next ›