Earlier quoted context omitted.
Yeah, let's just give up on readability
Alignment does not improve readability. Indentation is crucial, alignment is asinine.
What? Well aligning e.g. a long SQL statement is asinine and does not improve readability??
211–220 of 238 posts
Earlier quoted context omitted.
Yeah, let's just give up on readability
Alignment does not improve readability. Indentation is crucial, alignment is asinine.
What? Well aligning e.g. a long SQL statement is asinine and does not improve readability??
Earlier quoted context omitted.
> But you also have to decide at what point to hard wrap each line based on a max line length I think that you should not be doing this, for the same reason that you should use tabs. It allows the user to select whichever hard wrap point (if any -- I generally choose to not have one) they prefer. But all of this sort of thing is pointless debate these days, when it's pretty fast and easy to preprocess the files to ma…
>It allows the user to select whichever hard wrap point (if any -- I generally choose to not have one) they prefer. And then have merge conflicts between people who set different hard wrap points? Did you mean to say soft wrap point?
Rob Pike on why Go is indented with tabs [0]: > How wide should the indentation be? 2 spaces? 4? 8? Something else? > By making the indent be a tab, you get to decide the answer to that question and everyone will see code indented as wide (or not) as they prefer. > In short, this is what the tab character is for. 0: https://groups.google.com/g/golang-nuts/c/iHGLTFalb54/m/zqMo...
Exactly. Indentation != spacing. And thats all the argument i need. I dont understand why people argue with consistent text layout for all-spaces. You can use tabs to indent and spaces to align after that, in most cases.
Earlier quoted context omitted.
You can't use spaces to align because you can't assume a monospaced font will always be used. You can't use tabs either for that matter. If you need structure, use the language's punctuation and line breaks.
I can and do assume a monospaced font when using spaces to align code. Folks using variable width fonts will get what they deserve.
Earlier quoted context omitted.
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. gi…
Earlier quoted context omitted.
the correct rule is: tabs to indent, spaces to align [TAB][TAB][TAB]ShortTypename[SPACE][SPACE]variable_name [TAB][TAB][TAB]LongLongLongTypename[SPACE]variable_name2 ps. the [SPACE] counts above are illustrative, not accurate.
Exactly, just have your linter error out if there's a tab following a space
The point of the "tab" option is that there is no consensus on the number of spaces to use -- so by using tab, one uses a single character, and allows the developer to determine screen spacing to their comfort. "Tab" being a live option is a symptom of the war-never-over in absolute spacing degree -- since different people have different eye-sight, eye-strain, etc. constraints, different linguistic familiarities, cod…
Realistically tabs are best when you're alone and spaces are better when you're collaborating IMO.
Earlier quoted context omitted.
This works until someone tries to vertically align something like a table or a line that is wrapped.
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 sp…
Earlier quoted context omitted.
tabs for indentation, spaces for alignment
Meanwhile, I'm trying to get away from languages where whitespace has semantics.
I am fine with a (single) space being an important part of syntax, just don't use more than 1 please.
Tabs are better, simply because you can view them as you like. Go obviously does this, and Haxe too (with default formatting options, even tho its configurable)
It seems problematic to have a single character in the entire universe for characters render as variable, user controlled width.