Live data from Hacker News

The Tabs vs. Spaces war is over, and spaces have emerged victorious

xn--gckvb8fzb.com

211–220 of 238 posts

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#211
post #206
post #138

Earlier quoted context omitted.

Yeah, let's just give up on readability

Alignment does not improve readability. Indentation is crucial, alignment is asinine.

> 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??

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#212
post #62

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?

Yes, my mistake.

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#213

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.

I am very much against any alignment with spaces, just not needed, and adding a lot of unnecessary complexity to code formatting. Just use tabs for indentation, and don't mix them with spaces.

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#214
post #67

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.

Really please stop aligning with spaces!

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#215
post #80

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…

This "broken alignment" only happens when you mix tabs and spaces. If you do not align (with spaces) then all is fine. Please do not align at all, it is too arbitrary and altogether unnecessary.

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#216
post #143

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

And ever stronger if a space follows a tab..!

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#217

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…

I personally went through a phase where I compromised by doing one space per indentation level.

Realistically tabs are best when you're alone and spaces are better when you're collaborating IMO.

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#218
post #17
post #5

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…

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.

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#219
post #32

Earlier quoted context omitted.

tabs for indentation, spaces for alignment

Meanwhile, I'm trying to get away from languages where whitespace has semantics.

Very few where you can delete or insert whitespace at will, (even if only in the middle of 'identifiers').

I am fine with a (single) space being an important part of syntax, just don't use more than 1 please.

Re: The Tabs vs. Spaces war is over, and spaces have emerged victorious

#220

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.

No, that is its exact special purpose. And why have more than a single one??
Post reply on HN