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

    Correct. The way I’m used to it ( and how I thought the world worked ) is that the IDE gives tab a fixed length or characters. If you set it to 4 it would be the equivalent of 4 spaces or 4 letters or whatever.

    If my tab is set to 4 it would take up the width of 4 characters. If I need two indentations I would press tab twice.

    If bob then checks out my code and calls me a maniac and sociopath for using indentation and swears by “2”, the code would just look more condensed. The alignment would still work out because that’s done through spaces.

    var user_name = "Bob"
    var user_age[tab]= "Bob"
    

    This would align the = for Bob, because it needs two characters to align and that’s what his tab width is. It wouldn’t align for me because my tab width is 4. So I would.pur two spaces instead of the . That way it is aligned for everybody regardless of their tab width settings.

    The way you explain it sounds like how tabs works in MS Word ( or other word processors ).

    I don’t think I could work like that. I’ve only ever used IDEs to code ( regardless of how primitive they were back when I started). Interesting take though :D

    • jadero@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      10 months ago

      The way you explain it sounds like how tabs works in MS Word ( or other word processors ).

      That is exactly how they work, and after 40 years, I still struggle with the whole “tab as a shortcut for spaces” thing. It’s not that I started with word processors, either, just that as soon I started working with them, everything got so much easier for me.

      There are some code-specific things that keep me from just going back to a word processor, but I think our code editors are missing some useful features that are found in word processors.

      • fluckx@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        10 months ago

        Generally I’m not very preoccupied with it as the IDE just formats it the way I like it on save :D.