Yes, this. Which the counter point is either, Don't align things, or use tabs for indentation, and spaces for alignment.
And maybe you can enforce no alignment, but that's a hard fight to win.
And as far as tabs for indentation and spaces for alignment, I've found no practical way to enforce this via tooling/linting. And a rule without enforcement becomes inconsistent, which is how we get files full of mixtures of spaces and tabs, which is how people get frustrated with tabs, and we decide to throw it all out.
It would be crazy that spaces would have "won" because of the silly idiosyncratic alignment that some people seem to like and then teach to others for many decades.
That’s mostly editor braindamage (that has unfortunately leaked into some otherwise very good codebases, like LuaJIT). Indent things with tabs, align with spaces[1]:
if (foo) {
» frobnicate(bar,
» ...........baz);
}
Both camps will hate you, but things will work just as they should.
Actually for me this shows why tabs don’t deliver on their promise. As soon as the user’s tab size is small enough that baz doesn’t need to wrap, the user gets suboptimal formatting. As someone who prefers tabs of 2 and often views code authored with tabs of 4 I encounter this often.
Formatting by hand is probably only going to work for private hobby projects. In 99% of the other cases there needs to be a formatter that does the formatting.
I use tabs for indentation and spacing for alignment. Tables should be aligned with spaces. A wrapped line can be tabbed up to the start of the previous line and then spaced for alignment.
Arelius|7 months ago
And maybe you can enforce no alignment, but that's a hard fight to win.
And as far as tabs for indentation and spaces for alignment, I've found no practical way to enforce this via tooling/linting. And a rule without enforcement becomes inconsistent, which is how we get files full of mixtures of spaces and tabs, which is how people get frustrated with tabs, and we decide to throw it all out.
And inevitably, that's part of how spaces "won"
camel-cdr|7 months ago
throwawayqqq11|7 months ago
Addind a comment with the right amount of tabs as a table header and align all fields with spaces after the tabs would do the trick.
pepa65|7 months ago
mananaysiempre|7 months ago
[1] https://www.emacswiki.org/emacs/SmartTabs
jahewson|7 months ago
phplovesong|7 months ago
fsmv|7 months ago
bigcojosh|7 months ago
Arelius|7 months ago
No wonder why spaces "won"
AdamH12113|7 months ago
marssaxman|7 months ago
skylurk|7 months ago
phplovesong|7 months ago
fmbb|7 months ago
But if you must you can start with a new line and the right indent.
gte525u|7 months ago