You are viewing a single thread.
View all comments
92 points

Tabs are objectively the better choice as it allows each dev individually to decide tab width in their editors. Spaces in contrast don’t allow this same flexibility as they are used for much more than simply indentation, for example you likely put a space after each argument or operator IE func(arg1, arg2) or 1 + 2.

permalink
report
reply
17 points

Also, a lot of editors won’t unindent on backspace of spaces indentation, so I end up messing up the indentation with a 3/4 indent

permalink
report
parent
reply
3 points

That just sounds like a shitty editor, tbh. Pretty basic functionality.

permalink
report
parent
reply
-3 points

Autoformatter should fix that, unless you use python. (but even then they might fix it to the closest proper indentation level)

permalink
report
parent
reply
9 points

Sometimes. I love auto formatting, I spam the shit out of it more than I spam save but it’s definitely not perfect. It gets real confused with inconsistent indention like that. Especially with Python it’ll fuckup

permalink
report
parent
reply
6 points

Yeah you need an auto formatter, which is worse than not needing it. Also yes its terrible in python like languages

permalink
report
parent
reply
-1 points

Code can be viewed in more than just an editor. It might be in a terminal, rendered in a browser, etc. Sometimes you might even have to view it in an environment you don’t control. I am very disinterested in configuring each and every tool to have sensible tabstops, if such a tool can even be configured.

permalink
report
parent
reply
4 points

Then don’t? The whole reason nearly all the spaces guys do 4 spaces is cause that’s the nearly universal tab width. You won’t like this but the same exact argument can be made for spaces yet I’d bet you haven’t even once configured the width of those.

I don’t actually change tab width, it’s the default 4 spaces equivalent for me but just because I don’t take advantage of the ability doesn’t mean I should prevent others from doing so.

permalink
report
parent
reply
2 points

This is simply false, many systems have them configured by default to 8, particularly most CLI tools. Git, for example, is 8, and btw, changing it is not readily done and requires you to hack around it by using a custom pager command. In fact, all core gnu utils (and even bash itself) default to 8, as well vim, emacs, nano, gedit, etc.

I use 2 spaces since I work in Haskell, which is a significant whitespace language where you want certain syntactic constructs to exist at a different level of indentation from your main code block. So yes, I have configured it. 2 spaces is also exceedingly common for HTML (browser Dev tools renders HTML with 2 spaces, even).

There is not a universal indentation width, though it is almost always universal within a particular language or perhaps project, in which case it’s much better to have everything standardized. Code formatters enforced on a project are the norm, and those are way more impactful on how the code is read. But they are valuable because consistency is valuable. And yet, somehow you don’t have huge scores of developers complaining about being forced to format their code in a way they don’t like.

As I said, you don’t necessarily control the environment in which you are viewing code. A common example is reading code over a shared screen. So you can easily end up reading code in a way you don’t like anyway, so it may as well be some reasonable (if not preferable) standard that everyone is using.

permalink
report
parent
reply
2 points

The whole reason nearly all the spaces guys do 4 spaces is cause that’s the nearly universal tab width.

That is provably wrong. The default tab width in vim is 8 spaces, and the default indentation in yaml is two spaces.

permalink
report
parent
reply
-11 points

Too much waste of space imo, func(arg1,arg2) or 1+2 is faster to write and to read.

permalink
report
parent
reply
11 points

Stilltoomuchwasteofspace

permalink
report
parent
reply
2 points

Whyusemanywordwhenfewworddotrick?

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 7.2K

    Monthly active users

  • 955

    Posts

  • 37K

    Comments