Live data from Hacker News

Tabs or spaces – Parsing a 1B files among 14 programming languages

medium.com

101–110 of 124 posts

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#101
I've worked for 10+ years in the games industry, ranging from 10 a man 'indie' studio to 400 people (large for the games sector) studios. I am struggling to think of any project I have worked on that hasn't used tabs (including a huge Python project). This maybe a completely irrelevant data point, but I wondered if there is a chance the games industry has a natural preference for tabs?

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#102
post #12

After 20+ years of listening to the tabs-vs-spaces debate and considering all the legitimate points that both sides have, many have made the following observation and it's what resonates with me the most: In an ideal perfect world, _all_ of programmers and _all_ text editor tools would use tabs specifically for indentation and spaces specifically for alignment. But, we don't live in that perfectly coordinated world s…

Personally, I don't find the value in alignment - indentation is all I do. I especially dislike alignment of this sort: var a_variable = 1; var another_variable = 2; var yet_another_variable = 3; which is just too fiddlesome and in fact makes it _harder_ for me to read.

That's also hazardous when you later add an_even_longer_variable and then have to modify three extra lines to make them align.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#103
This is such a flamebait topic.

They could just as easily have posted a study of who uses emacs vs. vim. Well, maybe not as easily, and we'd all sit here debating the pros and cons of either.

Tools like gofmt will, over time, make these discussions moot.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#104
post #71

Earlier quoted context omitted.

Completely unrelated. Noticed you use Vala. Just curious, how do you find it? Do you just use it for GNOME related things (GUI building) or for other cases as well? Remember being interested in it a few years back. It seemed to be popular, but haven't followed it since.

Vala was my first introduction to OOP and since I was always working in a Unix environment C# was not an option for me. The bindings to develop GTK-based applications were good enough but still today I believe that using tools like Glade writing a GTK-based app in any other language is as easy as it is with Vala, the only advantage is that I can compile to C without having to write C all the time. It has worked well…

Thanks. Didn't know about Elementary OS and was surprised there is a good number of Vala projects on GH.

Yeah there is something appealing about compiling to C. It is a relatively easier target than LLVM or assembly. Nim is in that space, is making progress but it still suffers from a small community of developers.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#106
post #91

Neither! http://nickgravgaard.com/elastic-tabstops/ “ A better way to indent and align code ” When I saw this, it was obvious to me that this was the true solution to the problem which both space and tab proponents try to solve.

Yes, this seems like the best approach. The key for this to gain support is for Github's diff system to support it.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#107
post #81
post #30

Earlier quoted context omitted.

Right, not now you're dictating coding style to work around the warts associated with using tabs. If you use spaces there are no such issues because spaces don't change widths between editors.

The kind of formatting you suggest - aligning with spaces to get beautiful indenting - is a royal pain in the ass to edit. You change the function name to something a few characters shorter and now you have to change all the lines. It's prettier than the alternative, though (I still don't use it). I wish the pioneers of programming languages would have had the foresight to provide an automatic formatting tool and sta…

Some languages do have more-or-less canonical formatting styles. The Lisp family comes to mind, as do ML and Haskell. You see far fewer arguments about formatting there, partly because there's very widely-accepted style, and partly because nobody cares to argue about the few things that don't have established canon.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#108

Earlier quoted context omitted.

Personally, I don't find the value in alignment - indentation is all I do. I especially dislike alignment of this sort: var a_variable = 1; var another_variable = 2; var yet_another_variable = 3; which is just too fiddlesome and in fact makes it _harder_ for me to read.

That's also hazardous when you later add an_even_longer_variable and then have to modify three extra lines to make them align.

Exactly. To be fair, I believe most popular editors have plugins/shortcuts to do this. Or at least I hope people aren't doing this manually.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#109
post #96
post #52

Earlier quoted context omitted.

To be honest, no, because my formatting will not be broken after refactoring changing function name length.

What workflows do you have where renaming functions happens often enough that you need to optimize for it?

I do not really measure how often this happens, just rename as soon as name does not reflect exactly what function does.

Re: Tabs or spaces – Parsing a 1B files among 14 programming languages

#110
post #21

"One vote per file: Some files use a mix of spaces or tabs. We’ll count on which side depending on which method they use more." This makes results completely useless, as files of people who really do not care will count for one side or another randomly.

Or people who use a "mixed tabs and spaces" indentation, e.g. size 8 tabs with 4 characters wide indentation, and spaces for uneven indentations. (Which IMHO is broken because it leads to unreadable code when you don't have the same settings as the person who wrote the code).

Also, I guess C-style block comments could cause an over-counting of spaces (but looking at the numbers, it seems that either the query takes this into account, or C code simply has a poor comment-to-code ratio)

Post reply on HN