• SzethFriendOfNimi@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    5 months ago

    I know it’s a joke but I prefer the tab option. It’s easy to convert tabs to any particular spacing or code point width. It can also vary, if wanted, based on terminal or editor type.

    People with worse eyesight can have a wider indentation while those who choose can opt for something more compact

    • fluckx@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      5 months ago

      Honestly I always preferred tabs for indentation and spaces for aligning. It doesn’t break anyone’s experience. And if somebody wants two spaces for a two-space-tab-width for indentation and other people prefer four. That will work just fine.

      I hate seeing 2 space indents. Unreadable AF ( to me ). At least this way I can easily work in the same codebase without somebody being annoyed ( except for the crying about the tabs )

      • jadero@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        Why not tabs for both indentation and alignment? (Actually, I see indentation as just a specific use of alignment.) Word processors have been doing it for decades (and typewriters for over a century!). Surely we can convince our code processors to use user-definable, fixed position tabs instead of relative position “tab = x spaces”.

        Keeping the [TAB] character in the file then allows everyone the layout they like.

        Or has working solo for 40 years fried my brain?

    • kakes@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      5 months ago

      I can’t imagine it would be difficult for an IDE to scale the width of spaces found at the start of a line, to emulate this same customization while still preserving my sanity as a fervent space-indenter. I’ve never seen an IDE that does this, but it’d be an interesting compromise.

      • fidodo@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        5 months ago

        What if instead of having the IDE special case space characters at the start of a line, we had a special character that could represent a variable width space?

  • Traister101@lemmy.today
    link
    fedilink
    arrow-up
    2
    ·
    5 months ago

    Tabs are objectively the better choice as it allows each dev individually to decide tab width in their editors. Spaces in contrast don’t allow this same flexibility as they are used for much more than simply indentation, for example you likely put a space after each argument or operator IE func(arg1, arg2) or 1 + 2.

    • zea@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      Also, a lot of editors won’t unindent on backspace of spaces indentation, so I end up messing up the indentation with a 3/4 indent

    • expr@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      5 months ago

      Code can be viewed in more than just an editor. It might be in a terminal, rendered in a browser, etc. Sometimes you might even have to view it in an environment you don’t control. I am very disinterested in configuring each and every tool to have sensible tabstops, if such a tool can even be configured.

      • Traister101@lemmy.today
        link
        fedilink
        arrow-up
        2
        ·
        5 months ago

        Then don’t? The whole reason nearly all the spaces guys do 4 spaces is cause that’s the nearly universal tab width. You won’t like this but the same exact argument can be made for spaces yet I’d bet you haven’t even once configured the width of those.

        I don’t actually change tab width, it’s the default 4 spaces equivalent for me but just because I don’t take advantage of the ability doesn’t mean I should prevent others from doing so.

  • mindbleach@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    ·
    5 months ago

    Tabs exist specifically for spacing out stops. They’re viewer-configurable, avoiding holy wars about 4 or 8 or that one idiot suggesting 3.

    I do not give a shit if your seventeen-argument function has the overflow variables line up exactly with the paren. Just put them one step further in.

  • SendMePhotos@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    5 months ago

    But like… Correct me if I’m wrong but in my experience tab does not always equal 4 spaces.

    E: thanks all. I didn’t fully understand.

    • gitamar@feddit.de
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      That’s why it’s also a big accessibility feature. With big font sizes, four spaces are distracting but you can configure tabs to show up as one character, which is way more reasonable with font sizes larger than usual

      • Waraugh@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        1
        ·
        5 months ago

        I had a colleague that is legally blind in my second real job. The dude is brilliant (and hilarious) but these things would significantly enable or screw up his productivity. I have always felt fortunate to have had direct butt in seat exposure to the importance of accessibility at such a young age.

    • dan@upvote.au
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      That’s one of the benefits of using tabs. Some people might like 4 spaces for indentation, whereas others like 2 spaces. If you use tabs, you can configure your editor to use whatever tab size you want, and they’re just stored as tab characters in the file.

      Tabs for indentation, spaces for alignment (eg for ASCII art).