Consider this snippet, where tabs (⇥) equal four spaces (·) in my editor:
if (someCondition) {
⇥ Foo foo = SomeClass::SomeFunctionCall(myParameter1,
⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ··myParameter2,
⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ··myParameterN);
}
Looks good.Now you open this snippet in your IDE, where tabs are set to two spaces:
if (someCondition) {
⇥ Foo foo = SomeClass::SomeFunctionCall(myParameter1,
⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ··myParameter2,
⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ⇥ ··myParameterN);
}
This matters more when the presentation is important, like I might write ASCII diagrams in my code, are have a large matrix with elements aligned, or similar. if (someCondition) {
⇥ Foo foo = SomeClass::SomeFunctionCall(myParameter1,
⇥ ······································myParameter2,
⇥ ······································myParameterN);
} blah(
blip,
blop,
bloop
);
And anyway, 'you see the code the exact same way I saw it when writing it' has the following problems:1. It doesn't help because you were writing the code, I have to read it.
2. It doesn't help because the way my brain works most likely isn't 100% interchangeable with how yours does.
3. It may even not be true because I may be using a different editor, a different editor theme, a different font, or, by golly, an entirely different monitor resolution.
That being said, I will agree with my sibling comments which recommend the combination of tabs for indentation and spaces for alignment.
I'm following a junior who is working on a project where everything, including braces, is indented like that.
Some lines overflow on a 2k screen.
So stupid... And it requires much more effort than just indenting logically depending on the depth of the current block. You have to wonder why people do this to themselves and to their colleagues.
Please let go of that childish esthetic to align certain stuff with spaces.
That's not a good reason, there are way too many writers with poor design sensibilities, so flexibility is better.
And in your example you'd use elastic tabstops so that a single extra tab would visually expand to align arguments for you if you like it, but not for me if I don't
Why should you have control over what indentation width I choose to use?
There are a bunch of reasons why I might want a narrower or wider tab width. Most obviously, screen real estate - I might be coding on a tiny device.
When you do indentation and alignment properly (tab for indentation, space for alignment, as others have said), it's formatted the way the writer wants, while also respecting the reader's preference for tab width.
Spaces for indentation is incorrect, pure and simple. And the war is not "won".
In the spaces world, you have the battle over how large indentation should be and everyone has to live with what someone else chose.