this post was submitted on 17 Jun 2023
2 points (100.0% liked)

Programmer Humor

32453 readers
299 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] demonen@lemmy.ml 1 points 1 year ago (3 children)

I use tabs because I prefer 4-space indents and others might prefer 2-space indentation or the gross and unacceptable 6-space indentation.

If more than one person is working on a code base, there will likely be more than one preference, and with tabs everyone gets to just set their own tab width.

Yes, even the 3-space savages.

[–] noisytoot@lemmy.ml 0 points 1 year ago (2 children)

Tabs work fine as long as you don't align stuff. If you do, you have to assume a tab size and mix tabs and spaces.

[–] edward@lemmy.ml 1 points 1 year ago* (last edited 1 year ago)

Generally aligning stuff isn’t nice. But if you do, it’s tabs up to whatever level of indentation you’re at then spaces the rest of the way. So you wouldn’t have to assume a tab size. And the tabs and spaces have different semantic meaning (indent vs alignment) so mixing them makes sense. It's even built into Jetbrains IDEs, where it's called "Smart Tabs".

Although really just adding a level of indent is better than aligning.

load more comments (1 replies)
load more comments (1 replies)