Hacker News new | ask | show | jobs
by the_mitsuhiko 333 days ago
The war is mostly over because regardless of it you use tabs or spaces, the many modern languages use a code formatter and reformat to whatever is common. Languages that go with tabs are also now routinely mixing it with spaces for visual alignment and assume a certain tab width for total visual width enforcement.

On the other hand editors often now handle spaces as if they are tabs, even for cursor movement. So well. Both won?

I remember a time when people religiously claimed that both tabs need to be the way to indent but also that they have to be 8 spaces visually. I guess at least that war was lost since now even CSS allows you to change the number of visual spaces a hard tab has.

2 comments

No one who uses tabs would ever assume a certain tab width for visual alignment. What do you base that slanderous statement on?

I've also never heard anyone argue that someone else should configure some different tab width, is there a specific language ecosystem you were in that had these insane takes?

To quote the linux kernel style guide:

> Tabs are 8 characters, and thus indentations are also 8 characters.

Yes, tabs are used for alignment as well.

To quote the OpenBSD style guide:

> Indentation is an 8 character tab.

The GTK source code uses tabs when the number of spaces for indentation >=8. This goes against their coding-style document, but if you don't have tabs set to 8 you'll find the indentation broken.

git is the same: although it prescribes tabs if you don't set the width to 8 you'll find broken alignment everywhere.

Oh that's terrible. I guess I'm the one that's been living in a bubble. If that's the kind of people fighting the war on our side, no wonder we lost.
This is horrible and goes against the purpose of tabs. You should NEVER use tabs for alignment, only for indentation.
This "broken alignment" only happens when you mix tabs and spaces. If you do not align (with spaces) then all is fine. Please do not align at all, it is too arbitrary and altogether unnecessary.
And yet, navigating the code, you still have to got left-left-left-left to pass the indentation and it’s stupid. Tabs are here, everybody should use them, they are the logical better option, everybody knows it.
learn some vim based movement, jump to the next non space character.
alt-arrow

But it’s not what I mean. When navigating using the arrows it just breaks the flow because suddenly you “don’t move anymore.” Hard to explain, but it is real.