Live data from Hacker News

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

medium.com

91–100 of 124 posts

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

#92
Am I the only one that finds DATA interesting here? Has anyone actually posted the terabyte over BitTorrent or something so I could play with it while avoiding the "Don’t analyze the main [bigquery-public-data:github_repos.contents] table — at 1.5 TB, it will instantly consume your monthly free terabyte."?

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

#93
I wish he'd have also counted the files that use only spaces or only tabs compared to a mixture of both in the indentation.

My reason for being against tabs is that unless you have something like gofmt, somebody will inevitably screw up and put in indentation that mixes tabs and spaces.

The second thing to check would be tabs that aren't in the initial indentation whitespace of the line. The other inevitable screw-up is using tabs to do some kind of vertical layout that shows up right with exactly one tab stop size.

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

#94
post #68

Obligatory clip from Silicon Valley (Season 3): Tabs vs Spaces (Some potential storyline spoilers if you haven't seen Silicon Valley) https://youtu.be/SsoOG6ZeyUI

A vim user who prefers spaces to tabs but doesn't know about 'set expandtab'?

On every file I've edited for the past 15 years:

  // vim:set ts=8 sw=4 sts=4 tw=80 expandtab                                     :

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

#95
post #71

I couldn't care less about this, and I generally feel out of place when other programmers ask me about my preferences on this topic. I have written code in different programming languages, and just naming Go and PHP where Tabs and Spaces are the standard respectively — PHP mostly because of PSR — I simply don't pay attention to the character(s) used for the indentation, the tooling already does that for me, being gof…

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 for me, and was able to create corporate applications in the past. I don't use it with the same frequency now because of my current job, but it is still in my list of programming languages that I want to use for personal projects along with C++ and (recently) Go.

For people interested in the language I suggest them to take a look at Elementary OS documentation, they are one of the most popular projects using Vala in production and I am sure they will appreciate any contribution from beginners and experience developers: https://elementary.io/developerhttps://github.com/trending/vala

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

#96
post #52
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.

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?

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

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

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

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

That particular form of formatting is part of Python's PEP-8, which has tooling around it. Maybe not all editors have something built it, though.

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

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

Wouldn't that imply using tabs but with the added feature that tabs also allow for alignment?

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

#100
post #98
post #81

Earlier quoted context omitted.

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…

That particular form of formatting is part of Python's PEP-8, which has tooling around it. Maybe not all editors have something built it, though.

Editor is one thing and most fully featured editors probably have an indent mode like this. Then there's all the other tools, like diff/merge tools, automatic refactoring scripts, etc which don't work as well.

I'm not a fan of Python's significant whitespace or PEP-8 in the first place. It puts too much emphasis on aesthetics at the cost of practicality. Writing a parser or any tooling for that is just a pain in the ass. I do use Python occasionally but for very different reasons than aesthetics.

Post reply on HN