Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The reason the tabs vs spaces debate is silly

Name: Anonymous 2017-02-27 14:16

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: Anonymous 2017-02-27 14:59

tfw spacecucks waste at least 8 keystrokes per indent

Name: Anonymous 2017-02-27 15:23

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.

Name: Anonymous 2017-02-27 15:24

>>2
Go back to the imageboards.

Name: Anonymous 2017-02-27 15:28

Who the fuck uses 8 char tabstops when coding?

Name: Anonymous 2017-02-27 15:29

>>3
You misunderstood something. My scenario is that I wanted 8 space tabs for data files and 4 space tabs for code. That's an issue.

Also,
With a saner syntax like that of Python
IHSBT

Name: Anonymous 2017-02-27 15:30

Name: Anonymous 2017-02-27 15:31

>>5
linus

Name: Anonymous 2017-02-27 16:44

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

Name: Anonymous 2017-02-27 17:10

>>5
me

Name: Anonymous 2017-02-27 19:21

>>7
Is this supposed to be entertaining?

Name: Anonymous 2017-02-27 19:39

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

Name: Anonymous 2017-02-28 21:11

How does python deal with mixed spaces and tabs?

Name: Anonymous 2017-02-28 21:26

>>13
Chokes to death

Name: Anonymous 2017-02-28 21:59

sage

Name: Anonymous 2017-02-28 22:21

>>13
Works fine but a tab is equivalent to 8 spaces

Name: Anonymous 2017-02-28 22:35

>>12
It looks pretty horrendous to me.

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: Anonymous 2017-02-28 22:46

>>1
The reason that the debate is stupid is that you can just run indent.

>>5
Every emacs user.

Name: Anonymous 2017-02-28 22:47

Name: Cudder !cXCudderUE 2017-03-01 2:29

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: Anonymous 2017-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: Anonymous 2017-03-01 3:51

>>21
does that mean his iq changes depending on the room he's in?

Name: Anonymous 2017-03-01 4:07

>>20
Use tabs and set you tab width to one. Thanks.

Name: Anonymous 2017-03-01 8:43

>>19
lets see these guys implement difflib

Name: Anonymous 2017-03-01 12:50

>>22 (nice dubs)
It doesn’t matter what room he's in, he would still be a moron

Name: Anonymous 2017-03-01 13:39

>>25
Even if it's a really hot room?

Name: Emacs user 2017-03-03 22:05

>>18
Every emacs user.
I can confirm this is true.

Name: Anonymous 2017-06-21 3:34

>>20
From the writers of this monstrosity:


/* @dirname.c */
#include <stdio.h>
#include <string.h>

int main(int argc, char **argv) {
int i;

if(argc!=2) {
fprintf(stderr,"usage: %s string\n",argv[0]);
return 1;
}
if(!strcmp(argv[1],"//"))
goto step_6;
if(!argv[1][0])
goto single_dot;
for(i=0;i<strlen(argv[1]);i++)
if(argv[1][i]!='/')
goto notslash;
goto single_slash;
notslash:
for(i=strlen(argv[1])-1;argv[1][i]=='/';i--)
argv[1][i]=0;
if(strrchr(argv[1],'/')) {
for(i=strlen(argv[1])-1;argv[1][i]&&argv[1][i]!='/';i--)
argv[1][i]=0;
step_6:
for(i=strlen(argv[1])-1;argv[1][i]&&argv[1][i]=='/';i--)
argv[1][i]=0;
if(argv[1][0])
printf("%s\n",argv[1]);
else
single_slash: printf("/\n");
} else
single_dot:
printf(".\n");
return 0;
}


...comes Shitty Opinions: The Forum Post.

Name: Anonymous 2017-06-21 4:03

>indenting code manually like peasants instead of editor built-in

Name: Anonymous 2017-06-21 4:04

>>29
Who are you quoting?

Name: Anonymous 2017-06-21 8:00

>>30
>not intuitively reading the mental context of entire thread

Name: Anonymous 2017-06-21 11:27

>>31
That's an odd name.

Name: Anonymous 2017-06-21 13:40

Automatic/Smart indent is fine, as long as the language isn't FIOC/Python. Then it suddenly starts breaking code.

Name: Anonymous 2019-04-13 18:13

>>20
lol

Name: Anonymous 2019-04-13 19:21

All whitespace is bloat. Use the necessary minimum and nothing more.

Name: Anonymous 2019-04-14 0:00

-Tabs allow you to indent with only one keypress for indentation level instead of four

Name: Anonymous 2019-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: Anonymous 2019-04-14 0:04

>>36
To the spacefags' credit, most of them set Tab to insert 4 spaces instead of a Tab character.

Name: Anonymous 2019-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: Anonymous 2019-04-14 5:03

If i edit a python file and remove a single space, would anyone notice?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List