Remix.run Logo
chrisweekly a day ago

The choice isn't (tabs) vs (spaces).

It's (tabs && spaces) vs (spaces).

In the real world, there will always be spaces, whether used for indentation or not. Using tabs for indentation inevitably leads to a mix of both - which is, objectively, worse for maintenance and consistency.

112233 14 hours ago | parent | next [-]

Not to mention that space is a normal printable character, while tab is a control character, like carriage return. Control characters have very well defined meaning, that is very different in different contexts.

As an example, and I hope this is not a new information for most, in many text terminals it does not mean "advance forward to a multiple-of-8 position", it means "advance forward to next tab stop", and you can arbitrarily set those (e.g. HTS/TSC on vt220)

If tabs or spaces are mandated at editor level, how are you editing Makefile or TSV files?

I really do not understand anyone, who is against having support for any possible indentation, controlled by the user as is necessary for each use case.

PaulDavisThe1st a day ago | parent | prev | next [-]

the correct rule is: tabs to indent, spaces to align

[TAB][TAB][TAB]ShortTypename[SPACE][SPACE]variable_name

[TAB][TAB][TAB]LongLongLongTypename[SPACE]variable_name2

ps. the [SPACE] counts above are illustrative, not accurate.

throw-the-towel a day ago | parent | next [-]

The correct rule is: you shouldn't align.

hollerith a day ago | parent [-]

The code I maintain (Emacs Lisp) follows that rule.

TZubiri 7 hours ago | parent | prev | next [-]

Just imagine pressing the space bar 12 times for each line, or having to use :vimq! to handle that without going crazy

g-b-r a day ago | parent | prev [-]

Exactly, just have your linter error out if there's a tab following a space

Etherlord87 a day ago | parent | prev | next [-]

And if people didn't align text, you could still make an argument that people use spaces to separate identifiers or otherwise tokens, therefore it's spaces vs tabs&spaces…

Tabs are for indentation, to align the beginning of the line, later on if you want to align text somehow, use spaces. You probably shouldn't align lines with different indentation (I align rarely so I can't remember ever to do that).

lioeters 17 hours ago | parent | prev [-]

I'm amazed that your comment is the single reasonable take among this entire discussion full of unsupported assertions and opinions.

Having two different invisible characters to represent empty space is objectively worse. Just use space, and the tab key to insert multiple spaces. Simple. Use .editorconfig and a formatter to enforce the commonly accepted standard. Done.

Sadly you still have to make exceptions for Makefile, Go, etc. that expect a mixture of hard tabs and spaces. Otherwise hard tabs are not allowed in the codebases I manage, and are replaced by the formatter.