Skip to content

Let's use 4 spaces instead of 2 #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Let's use 4 spaces instead of 2 #57

wants to merge 1 commit into from

Conversation

certik
Copy link
Member

@certik certik commented Dec 31, 2019

I think most people agreed to use 4 spaces instead of just 2.

I think most people agreed to use 4 spaces instead of just 2.
@zbeekman
Copy link
Member

zbeekman commented Dec 31, 2019

@certik you need to change .editorconfig too!

I list the reasons why I changed it back to 2 below, but if you want 4 that's fine by me.

EDIT: A bunch more people have weighed in on this thread so the results listed below are essentially moot, it looks like we're going with 4 spaces. 🎉

Preferences (from #3):

3 preferences for 2 spaces and 3 for 4 spaces.
So, as you can see there is effectively a tie.

Further considerations from #3

My further understanding from #3 was that a consensus was reached by the majority that:

  • module, submodule and program units should be indented
  • procedure, type and interface bodies should be indented
  • usual control constructs should be indented
  • should strive to stay within 80 chars, with a hard limit of 132

Given the concerns about line length when indenting procedure bodies etc. and the effective tie in preference for 2 vs 4 combined that 2 is the default for findent I thought it prudent to switch to 2. However, I may have misinterpreted or overstated the consensus reached on the other bullet points above.

We should pick a convention and finalize this decision so people can sink their teeth into writing some code.

Setting up editorconfig for per-project style/indentation

Also, a note for @certik and other vim users: If you install the vim editorconfig plugin you won't have to mess with your global preferences. It will/should use the indentation specified in .editorconfig when working on files for stdlib, and then your default when not. Many/most editors respect .editorconfig out of the box, and plugins for others, like Emacs are easily installed.

Copy link
Member

@zbeekman zbeekman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to make this change, please edit .editorconfig too

@gronki
Copy link

gronki commented Dec 31, 2019 via email

@certik
Copy link
Member Author

certik commented Dec 31, 2019 via email

@milancurcic
Copy link
Member

Considering the development here, I change my preference to "don't care". :)

I'd also approve of allowing both 2 and 4 spaces, not mixed together within a source file.

@jacobwilliams
Copy link
Member

I vote for 4 spaces! :)

@zbeekman
Copy link
Member

I was only responding to your comment at the top of the PR and providing a rationale and evidence in support of my past decision:

I think most people agreed to use 4 spaces instead of just 2.

I'm fine with either. Listing the number of spaces used by the top Fortran projects is not a good use of my time.

The biggest one, OpenBLAS, appears to use 3 spaces FWIW.

A final note before I completely abstain from further comment on indentation: Just because a library is big and popular doesn't mean we want to do what they did; tradition for tradition's sake alone isn't a compelling reason to do something! (If it were we'd all be writing F77 still.)

Ah, thank goodness, @jacobwilliams broke the tie!!! Haha. Yes, please god let us use 4 spaces, just make sure that .editorconfig is updated too.

@milancurcic
Copy link
Member

Ugh.

@gronki Please, please if you don't have anything constructive to add to the thread, just don't post. This is a good example of the kind of communication that isn't helpful. Please read Code of Conduct if you haven't yet.

@jvdp1
Copy link
Member

jvdp1 commented Dec 31, 2019

Let's change my preference from 1 or 2 to don't care. I can easily adapt Vim.

@septcolor
Copy link

Just FWIW, here are some indentation used by the standard libraries of some other languages (which I think may be more or less related to numerical computing).

4 spaces:

2 spaces:

(I haven't checked other languages like JS, C#, Java, etc). So the choice seems to vary. I personally use 4 spaces for distinguishing block structures more clearly, but also feel that codes with 2 spaces are more compact. (I used 3 spaces for Fortran77, which was the default of Emacs at that time...)

@gronki
Copy link

gronki commented Dec 31, 2019

Ugh.

@gronki Please, please if you don't have anything constructive to add to the thread, just don't post. This is a good example of the kind of communication that isn't helpful. Please read Code of Conduct if you haven't yet.

I know the Code of Conduct, what I basically meant is that it doesn't matter in my opinion considering the amount of decisions that have to be made that do matter. If you find my comments not constructive I think it's time from my side to move away to where I can actually help.

@zbeekman
Copy link
Member

I'll open a PR to change back to 4 spaces, and fix .editorconfig to reflect this while I'm at it.

@milancurcic
Copy link
Member

milancurcic commented Dec 31, 2019

I know the Code of Conduct, what I basically meant is that it doesn't matter in my opinion considering the amount of decisions that have to be made that do matter. If you find my comments not constructive I think it's time from my side to move away to where I can actually help.

Thanks. I was addressing this specific comment and not your other posts, many of them helpful. Clean and constructive communication is important.

@certik
Copy link
Member Author

certik commented Dec 31, 2019 via email

@zbeekman
Copy link
Member

Honestly I think everyone is fine with 4 at this point. I'll change the text to 2 or 4 if you prefer, but I'd rather pick one (4) that can be automated in hooks and checked in PRs.

@scivision
Copy link
Member

normally I prefer 2 spaces for Fortran projects, where the procedures are often longer than ideal. Since this is a fresh project, there may be more consciousness of procedure cyclomatic complexity. Thus 4 spaces would be less likely to result in excessive indentation->too much line continuation.

@certik
Copy link
Member Author

certik commented Dec 31, 2019

@zbeekman and I talked about this on the phone. We can either choose now, or postpone this decision for later. We both prefer to decide now, because that allows us to setup automatic formatting at the CI, and move on. So we both agreed to make a choice now, see how it works for us, and we can revisit later if needed.

Then the question is whether to choose 2 or 4 spaces today. We agreed to go with 4.

@certik
Copy link
Member Author

certik commented Dec 31, 2019

I created this PR via GitHub and it pushed a branch into the main repository. So I just created #60 from my own fork. I am going to close this PR in favor of #60.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants