I hereby declare end of discussion (at least for me), spaces because most other programmers use spaces. Unless you are joining the project that consistently uses tabs, then use tabs. Otherwise spaces.
Tabs or spaces – Parsing a 1B files among 14 programming languages
51–60 of 124 posts
Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#52Earlier quoted context omitted.
Your point is valid, that's why I write function( really_really_really_really_really_long_argument1, really_really_really_really_really_long_argument2, really_really_really_really_really_long_argument3);
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.
Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#53Earlier quoted context omitted.
My other personal feeling is that it's easy to auto-check we aren't using tabs (just search for tabs, and reject if any are found). Depending on how you choose to format, it can be arbitrarily hard to check tabs are being used correctly. For example, many people want to do some space indenting, such as: void my_function(int arg1, int arg2, int arg3) { It's (I believe) impossible for a language-agnostic tool to know t…
Don't align. void my_function( int arg1, int arg2, int arg3, ... ) {
Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#54Earlier quoted context omitted.
1. That's a band-aid. The characters have still been changed - the diff still "exists". 2. Those options are not perfect, they don't always work as expected 3. Those options are not turned on by default (because that would be INSANE) 4. Git's not the only VCS, much as I wish it were 5. Github's not the only Git web UI; that option is not available everywhere. It's not a "solved problem". It's an artificial problem, t…
> It's an artificial problem, that gets solved when you start consistently stripping trailing whitespaces on save and not realigning everything all the time. This is mostly solved via coding standards. If there are no coding standards people will "refactor" the coding style when they touch various pieces of code. If people were following a consistent style, then the alignment wouldn't be changing all of the time. Alt…
enum {
NORMAL = 1
ABNORMAL = 2
IRREGULAR = 3
}
Now if you're writing like this, what happens when you introduce "EXCEPTIONAL = 4"? You change 3 other unrelated lines. This is something that alignment causes, regardless of "coding standards". Hell, gofmt does that... It looks pretty (to some extent - with long names and lots of members it gets unreadable), but creates so much noise.Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#55I've never really understood why you would use several characters (=spaces) for something that is semantically one indent. Can someone enlighten me? What are the advantages of spaces over tabs?
def doSomething( parameter1 , parameter2 , parameter3 ): pass How would you make all the punctuation line up using tabs?
But then tabs vs. spaces isn't an issue.
Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#56Earlier quoted context omitted.
People always talk about consistent display of spaces whereas tabs might be shown as 4 spaces or even 8. Of course that means you can usually customize how tabs are rendered unless you code in Notepad or something crazy.
Lots of people need to access files on a server via Emacs or Vim. Having to deal with tabs there can be very frustrating.
Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#57Now, can we look at the same repositories and look at the number of bugs and correlate it with the use of spaces? But in all seriousness, how often something is used isn't an indication of how good it is. Spaces are like cigarettes. Just don't start.
Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#58Obligatory clip from Silicon Valley (Season 3): Tabs vs Spaces (Some potential storyline spoilers if you haven't seen Silicon Valley) https://youtu.be/SsoOG6ZeyUI
Wrong link :) https://youtu.be/SsoOG6ZeyUI
Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#59I find it interesting that C++ using the .cc extension has about 7% tabs, whereas C++ using the .cpp extension has about 36% tabs. I wonder what else is different about these two groups.
Re: Tabs or spaces – Parsing a 1B files among 14 programming languages
#60Earlier quoted context omitted.
or python, or rust.
Python doesn't care either way as long as indentation is consistent (though there's a common misunderstanding that Python cares). However PEP-8 specifies that code should be indented using 4 spaces and editors should be configured to render tabs as 8 spaces (likely to make mixed tabs & spaces really obvious). But PEP-8 also specifies that code should follow whatever is the coding standard in a given project. IOW, Pyt…