this post was submitted on 05 Sep 2023
2 points (100.0% liked)

Programming

20684 readers
325 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] xigoi@lemmy.sdf.org -1 points 2 years ago (2 children)

Tabs let you define how big you want each indent to be

…except when they don't. Many common environments have a hardcoded tab size of 8, which is insanely big for using it for indentation.

[–] wgs@lemmy.sdf.org 1 points 2 years ago (1 children)

Because other people might have restricted environment which might not suit their preference is not a good reason to level it down IMO.

Also, I think 9 is the best size for indent (matter of preference), do you think I should switch to space so everyone can enjoy this wonderful view I have ?

[–] agitated_judge@sh.itjust.works 0 points 2 years ago (1 children)

Ah, the best kind of indent. A tab and a space.

[–] wgs@lemmy.sdf.org 1 points 2 years ago

Or just set tabsize to 9, that's the point :)

[–] IRQBreaker@startrek.website 0 points 2 years ago (1 children)

As an embedded software developer that does linux kernel drivers I've come to love the tab size 8 indentation level.

I'm paraphrasing: "if your indentation level gets too deep, it's time to rethink/refactor your function."

And with tab 8 you'll notice it rather quick if your function does too much/unrelated stuff.

A function should be short and do one thing only, if possible. It also makes unit testing easier if that's a requirement.

[–] xigoi@lemmy.sdf.org 1 points 2 years ago

When you're operating on such a low level of abstraction, it's no wonder you don't need deep nesting.