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.

  • Gormadt@slrpnk.net
    link
    fedilink
    English
    arrow-up
    3
    ·
    3 hours ago

    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

  • BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    7
    ·
    5 hours ago

    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

    • rektdeckard@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      2 hours ago

      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.

  • ikidd@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    1
    arrow-down
    2
    ·
    2 hours ago

    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?

    • toynbee@lemmy.worldOP
      link
      fedilink
      arrow-up
      4
      ·
      2 hours ago

      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.

  • neidu4@piefed.social
    link
    fedilink
    English
    arrow-up
    11
    ·
    8 hours ago

    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.

    • anotherandrew@lemmy.mixdown.ca
      link
      fedilink
      English
      arrow-up
      3
      ·
      3 hours 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.

    • 0ops@piefed.zip
      link
      fedilink
      English
      arrow-up
      9
      ·
      7 hours ago

      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

  • masterspace@lemmy.ca
    link
    fedilink
    English
    arrow-up
    29
    arrow-down
    5
    ·
    12 hours ago

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

    • Victor@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      35 minutes ago

      Everything that doesn’t align with my subjective, personal mental model is stupid. 😭

    • fonix232@fedia.io
      link
      fedilink
      arrow-up
      9
      arrow-down
      1
      ·
      10 hours ago

      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.

      • masterspace@lemmy.ca
        link
        fedilink
        English
        arrow-up
        4
        arrow-down
        2
        ·
        6 hours ago

        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.

      • masterspace@lemmy.ca
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        3
        ·
        6 hours ago

        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.

      • dev_null@lemmy.ml
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        9 hours ago

        With tab you end up with two. Unless you write if<tab>(foo<tab>==<tab>bar)<tab>{ <tab>…

    • toynbee@lemmy.worldOP
      link
      fedilink
      arrow-up
      8
      arrow-down
      6
      ·
      edit-2
      11 hours ago

      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.

      • masterspace@lemmy.ca
        link
        fedilink
        English
        arrow-up
        4
        arrow-down
        8
        ·
        6 hours ago

        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.

        • toynbee@lemmy.worldOP
          link
          fedilink
          arrow-up
          5
          arrow-down
          3
          ·
          5 hours ago

          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.

          • masterspace@lemmy.ca
            link
            fedilink
            English
            arrow-up
            4
            arrow-down
            4
            ·
            5 hours ago

            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.

            • toynbee@lemmy.worldOP
              link
              fedilink
              arrow-up
              4
              arrow-down
              2
              ·
              5 hours ago

              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.

              • masterspace@lemmy.ca
                link
                fedilink
                English
                arrow-up
                4
                arrow-down
                1
                ·
                5 hours ago

                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.

                • toynbee@lemmy.worldOP
                  link
                  fedilink
                  arrow-up
                  1
                  arrow-down
                  2
                  ·
                  5 hours ago

                  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.

    • hoshikarakitaridia@lemmy.world
      link
      fedilink
      arrow-up
      5
      arrow-down
      4
      ·
      11 hours ago

      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.

  • HubertManne@piefed.social
    link
    fedilink
    English
    arrow-up
    9
    arrow-down
    1
    ·
    10 hours ago

    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.

    • andyburke@kbin.earth
      link
      fedilink
      arrow-up
      8
      ·
      6 hours 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.

        • toynbee@lemmy.worldOP
          link
          fedilink
          arrow-up
          2
          ·
          7 hours ago

          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?

          • HubertManne@piefed.social
            link
            fedilink
            English
            arrow-up
            1
            ·
            6 hours ago

            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.

            • toynbee@lemmy.worldOP
              link
              fedilink
              arrow-up
              2
              ·
              6 hours ago

              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.

  • burt@programming.dev
    link
    fedilink
    English
    arrow-up
    3
    ·
    9 hours ago

    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.

  • dudeface@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    11 hours ago

    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

    • anotherandrew@lemmy.mixdown.ca
      link
      fedilink
      English
      arrow-up
      1
      ·
      3 hours ago

      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.

    • fonix232@fedia.io
      link
      fedilink
      arrow-up
      2
      ·
      10 hours ago

      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…

      • toynbee@lemmy.worldOP
        link
        fedilink
        arrow-up
        5
        arrow-down
        2
        ·
        edit-2
        1 hour ago

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

        edit: remove extra space.

        • dudeface@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          1 hour ago

          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

          • toynbee@lemmy.worldOP
            link
            fedilink
            arrow-up
            1
            ·
            1 hour ago

            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.

            • dudeface@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              47 minutes 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

  • molehill_siesta@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    2
    ·
    8 hours ago

    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.

  • CombatWombat@feddit.online
    link
    fedilink
    English
    arrow-up
    3
    ·
    10 hours ago

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

  • one_old_coder@piefed.social
    link
    fedilink
    English
    arrow-up
    2
    ·
    12 hours ago

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

    • toynbee@lemmy.worldOP
      link
      fedilink
      arrow-up
      2
      ·
      12 hours ago

      Spaces themselves are not problematic. They seem to do their job fairly well. Their job, however, is not indentation.