By the way, what's the misunderstand with lining things up?
By the way, what's the misunderstand with lining things up?
The real problem comes when people start aligning things on the middle of the line.
So instead of this:
def some_method(param1
param2):
statement1
you do this: def some_method(
param1,
param2):
statement1
Hanging indents work regardless of whether you use tabs or spaces for indentation.Fixed width:.good
Flexible:....not good
.............so not good
const ONE = 1;
const MILLION = 1_000_000;
Even without non-whitespace it's a problem:def foo(arg1,
........arg2,
........arg3)
For the second one, I'd write it this way.
def foo(
....arg1,
....arg2,
....arg3)
I prefer that even in a fixed width font.
> If you use spaces to indent code, or in any way rely on a fixed width font to "line things up", you have a fundamental misunderstanding.
As long as the limitations of lining things up "exactly" are avoided, spaces shouldn't be any different than whatever way comes from true understanding.
If anything, the editor should "render" the text in a form that is pleasant to the eye, divorcing the meaning from the presentation.
Lining up things too much is a "works for me" way of baking presentation into the data, where the writer assumes that because it looks good o their setup, it will look well for the reader too.
Similarities can be seen to building web pages on tables, sending around Word documents, or hard-wrapping emails.