this post was submitted on 21 May 2024
100 points (94.6% liked)

Asklemmy

43902 readers
1106 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_[email protected]~

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 70 points 6 months ago (3 children)

Uses spaces instead of tabs.

[โ€“] [email protected] 11 points 5 months 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.

[โ€“] [email protected] 5 points 6 months ago (2 children)

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

[โ€“] [email protected] 9 points 5 months ago (1 children)

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

[โ€“] [email protected] 3 points 5 months ago* (last edited 5 months 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.

[โ€“] [email protected] 3 points 5 months ago (1 children)

i'd probably use tabs if they weren't so massive by default.

do people actually use 8 space wide tabs? if so, what for?

[โ€“] [email protected] 5 points 5 months ago (1 children)

Most editors have them at 4 by default.

[โ€“] [email protected] 2 points 5 months ago

oh. i guess i'm using the wrong editors then :P