is because spaces are vastly superior. And I'm not sure how so many people were convinced otherwise. The biggest issue with using tabs is that people tend to want different tab widths for code versus other scenarios, like tab delimited data files for example. I would want 4 for the former and 8 for the latter. Changing it based on file type still leaves you with some bad scenarios.
And the reasons idiots use tabs are horrible. -Tabs create smaller file sizes. Do you also use smaller variable names? This one is nonsense. -Tabs allow you to control the indentation on your end. You don't get to decide what the code looks like that someone else wrote. I cringe when I see an opening brace on a separate line, but there's nothing you can do about it.
Also, if you're using an editor that shows whitespace, spaces look way better than tabs. Please stop using tabs.
Name:
Anonymous2017-02-27 14:59
tfw spacecucks waste at least 8 keystrokes per indent
No, that's wrong. If we're talking about generic curly brace syntax, then there should only be tabs between the end of the newline character until the first non-whitespace character. If you you follow these guidelines, then your spacing will be correct no matter the tabwidth of the editor. Additionally, one logical source line should map to one physical line in the source file. There is no need to break a long line of code at the 80-character mark so that it wraps. Editors and IDEs have widely variable widths, so it is up to the reader of the code to make a long line wrap as he pleases.
If we follow these guidelines, we have reduced the most popular indentation styles down to a pair: the style in which a brace is placed on the newline (Allman-type) and the style in which it is not (K&R-type). Because a block is its own statement, it should be placed on a newline; indeed, it doesn't make sense to place the opening brace before a newline. By a similar argument, the closing brace should be placed at the end of a line. We can also place multiple opening or closing braces on the same line, which we should have been doing anyway.
Here is a contrived example of a snippet of a C source file:
int someArray[3][4] = {{ 1, 2, 3, 4 }, {5, 6, 7, 8}, {9, 10, 11, 12}}; // ... int quux; // ... int foo(int bar, int baz, char *baz) {int q = bar * baz / quux; while (1) {int r = 0; for (int i = 0; i < q; j++) {r += *(baz + i);} return r * someArray[bar % 3][baz % 4];}} // ...
With a saner syntax like that of Python, we could just use tabs and newlines to define the block structure. But since our other popular languages are still littered with curly braces, the best we can do is to tidy them up so that the source flows neatly over linebreaks.
>>1,2 The main benefit of tabs is that you don't need to press as many keys to indent. However, they mess up the whole concept of "columns", since a tab is technically one character, yet it is as wide as usually 8 characters, even in a monospace font where all characters are supposed to be the same size. The ideal solution is to use an editor that translates tabs into an appropriate number of spaces (4 seems just right for programming), but if working in a minimalist editor like Notepad, you're just going to have to accept pressing the spacebar four times.
>>11 Without context no. Actually that season wasn't funny with context. But I like the show for being the only show about software development that isn't horrendous.
I'd rather watch something that humorously gets everything wrong ( https://youtu.be/O2rGTXHvPCQ ) than something that reminds me how many stupid hipsters are in this field.
Name:
Anonymous2017-02-28 22:46
>>1 The reason that the debate is stupid is that you can just run indent.
One space is clearly the superior choice. You get code that looks the same everywhere, saves on filesize, and you don't have to use the awkward tab key. As an added bonus, the column counter tells you exactly what indent level you're on.
Name:
Anonymous2017-03-01 2:32
>>20 Watch your grammar dip shit and stop making fool out of yourself publicly....oh right you are the one of these geniuses with IQ below room temperature.....
Name:
Anonymous2017-03-01 3:51
>>21 does that mean his iq changes depending on the room he's in?
Name:
Anonymous2017-03-01 4:07
>>20 Use tabs and set you tab width to one. Thanks.
All whitespace is bloat. Use the necessary minimum and nothing more.
Name:
Anonymous2019-04-14 0:00
-Tabs allow you to indent with only one keypress for indentation level instead of four
Name:
Anonymous2019-04-14 0:03
Tabs are better.
Tabs for indentation encode semantic meaning. A tab character is for indentation. A space can be to separate words, alignment, making ASCII art in comments, etc., a whole lot of shit. Source code using spaces for indentation forsakes all the information about where lines should be indented. Unless some algorithm is used to guess which spaces are meant for indentation (which could make mistakes), other people cannot automatically change the way your space-indented source code is aligned. You can easily replace all tabs with 4 spaces but can't reliably do the same thing in reverse.
All editors can be configured to display tabs any way you want. Good editors can align code without inserting physical spaces. Every advantage of spaces is irrelevant in a world where people use editors more advanced than notepad.exe.
Name:
Anonymous2019-04-14 0:04
>>36 To the spacefags' credit, most of them set Tab to insert 4 spaces instead of a Tab character.
Name:
Anonymous2019-04-14 4:23
How do people ensure they indent 8 spaces and not 7, 16 and not 17? Do they look up column indexes for each level of indentation?
Name:
Anonymous2019-04-14 5:03
If i edit a python file and remove a single space, would anyone notice?