• Luna
    link
    fedilink
    English
    701 month ago

    Uses spaces instead of tabs.

    • @Nevoic@lemm.ee
      link
      fedilink
      111 month ago

      As someone who has primarily used spaces, I still use the tab key. I sincerely hope most space users understand that your editor can expand your tab key into spaces, and people aren’t genuinely going around spamming their spacebar 2->16 times for various indentation levels.

    • @Coconut1233@lemmy.world
      link
      fedilink
      51 month ago

      Spaces are kinda better, because tabs are not consistent across editors/platforms. Just please use the tab key to indent, don’t press the spacebar x times like a monkey

      • Luna
        link
        fedilink
        English
        91 month ago

        I prefer tabs because they aren’t consistent

        I personally find 2-space indented code harder to read than 4-space. If I’m working on someone else’s codebase which is indented with 2-spaces then I have to cope. But if it’s tab-indented then I can just edit the setting in my editor to display a tab char as 4 whitespace chars

        • @SorteKaninA
          link
          3
          edit-2
          1 month ago

          The problem is that when you then want to align stuff, you have to use spaces. So you need to use tabs for indentation and use spaces for alignment. This is actually the perfect, objectively best way to do it, but because it requires a deliberate mix of tabs and spaces, it’s too complicated to use for a large project with lots of maintainers. You just need a single maintainer doing it wrong to ruin it.

          There is also the issue that you’ll often see the code in a place where you can’t control the tab length, i.e. printed in your terminal by some program that doesn’t have an option for that, or viewed on the web, like GitHub.