by phplovesong · 1y ago · 0 comments
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"
To take this example from a sibling post:
if (foo) {
» frobnicate(bar,
» ...........baz);
}
Many people will wind up doing this: if (foo) {
» frobnicate(bar,
» » » ...baz);
}
And then your alignment is all messed up if you have a different tabs setting.Checking for that requires something more like a linter with a detailed understanding of the syntax parse tree.
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.
if (foo) {
» frobnicate(bar,
» ...........baz);
}
Both camps will hate you, but things will work just as they should.Of course that will always be a compromise, either people who use narrow tab widths or those who use wide ones will have a (slightly) suboptimal experience.
No wonder why spaces "won"
I am fine with a (single) space being an important part of syntax, just don't use more than 1 please.
Accessibility is not a joke.
See, I can do it too. This is why there is an ongoing discussion. Because there is no clear cut answer, just opinions.
At least this article brings some data to the discussion.
but that's the whole damn point ... I like substantively indented code, you prefer minimally indented, we should both be happy (and we can be, by using tabs).
This is often why dev teams have more specific style guides that include things would be considered bike-shedding, like how many spaces an indent is.
Why not bikeshed the bikeshedding?