Live data from Hacker News

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

xn--gckvb8fzb.com

41–50 of 238 posts

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

#44

The choice isn't (tabs) vs (spaces). It's (tabs && spaces) vs (spaces). In the real world, there will always be spaces, whether used for indentation or not. Using tabs for indentation inevitably leads to a mix of both - which is, objectively, worse for maintenance and consistency.

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.

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

#45
post #40

Tabs are the modern choice, because you can then configure your editor so that for every tab character, it calls an LLM with the buffer contents up to that point, with instructions to generate an appropriate number of spaces that can then be substituted in. You might be thinking 2, 4, or 8, but the LLM will give you the contextually-correct answer.

LLM? Emacs has been doing this for decades without any such technology.

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

#46

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.

> You can use tabs to indent and spaces to align after that, in most cases.

In practice this is difficult; since the characters are invisible by default, people will inevitably mix up the two. Looks like the industry standard is to give up and use spaces everywhere, unless strict and mandatory tooling exists.

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

#47
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…

Or dont try to align lines with different indentation levels.

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.

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

#49
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.

It's not about semantics at all. whitespace has (virtually) no semantics in C or C++, but there are few programmers who would feel comfortable reading such code without the suggestive hinting that indentation provides.

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

#50

Earlier quoted context omitted.

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.

You use tabs to delimitate tabular data. Unless you're trying to argue that your code is a tsv file then tabs is the wrong thing to use.

You use line feeds (\n) to instruct your teletype machine to feed in one more line of paper. Unless you're trying to argue that your text editor is a teletype machine, then line feeds are the wrong thing to use.
Post reply on HN