Skip to content
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

Code style for Fortran examples in the tutorials? #60

Open
jvdp1 opened this issue Jun 7, 2020 · 12 comments
Open

Code style for Fortran examples in the tutorials? #60

jvdp1 opened this issue Jun 7, 2020 · 12 comments
Labels
section: learn Relevant for the learn section on the webpage

Comments

@jvdp1
Copy link
Member

jvdp1 commented Jun 7, 2020

In both fortran-lang/fortran-lang.org#99 and fortran-lang/fortran-lang.org#96 the code style is mentioned. Should we use the same code style as for stdlib?

@LKedward
Copy link
Member

LKedward commented Jun 7, 2020

It makes sense to adopt the same code style guidelines for all Fortran-lang projects.

Unfortunately I have a strong gripe with the stdlib code style which is the 4-space indentation.
I realise the time has passed for me to voice my opinion on this, however my reasoning is that limiting line lengths to 80 characters is really useful for readability and side-by-side editing, but 4-space indentation massively reduces the amount of usable line length and leads to many line-continuations which greatly reduce readability. 2-spaces are perfectly sufficient for indentation and don't eat-up your usable characters.

@milancurcic
Copy link
Member

Laurence, I also oppose the 4-spaces indent. I can't find the original poll now, but I vaguely recall that it was about 50-50 between 2 and 4 spaces, perhaps slightly in favor of 2. It may be time for another vote.

But we need a dedicated style guide for the tutorials (you'll see that many items in the stdlib guide don't apply here), and be consistent with it.

@jvdp1
Copy link
Member Author

jvdp1 commented Jun 7, 2020

Here are the issues related to this topic in stdlib: [#57](https://github.com/fortran-lang/stdlib/pull/57] and #3

It is indeed maybe worthwhile to re-open it.

@LKedward
Copy link
Member

LKedward commented Jun 7, 2020

Thanks for the links @jvdp1 - I would support re-opening the discussion on spaces, but that is for another thread.
PS. I also notice that the line limit problem is made worse in stdlib by needing to also indent preprocessor blocks.

@everythingfunctional
Copy link
Member

I have a suggestion on how we should work through defining a style guide. Lot's of people are going to have very strong opinions on the subject, and on each aspect of code style. We should have some example code (several probably), format it according to various styles, and have a community wide poll on what people find most readable. Hopefully this can minimize the arguing.

@certik
Copy link
Member

certik commented Jun 8, 2020

We went with 4 spaces with the idea that we can re-evaluate in few months.

Let's do what @everythingfunctional suggested. So let's take representative codes, indent them with the various way, and let the community vote.

If there is a clear winner, let's go with that. If there is not a clear winner, then we'll have to decide what to do. We spent a lot of time on this before, so I would prefer, if possible, that we don't waste weeks of time on this again. I understand if the current setup is irritating, that people are unhappy. If we switch, it will be irritating to some others. I personally definitely prefer 4 spaces, just like in Python and C++ (however I do not indent inside modules and subroutines, to save horizontal space), but I will go with whatever the community prefers based on the votes, and if it's 2 spaces, we can do that.

@smeskos
Copy link
Contributor

smeskos commented Jun 20, 2020

I suggest that we move forward with a poll to decide whether people want a code style or not. If yes, we should proceed asap with a survey on the details. I mentioned this issue yesterday at the monthly call, and I insist again, here, because now is the time to decide while the project is still young with only a few lines of code uploaded, and while the main contributors are all active and can quickly refactor their codes. If it takes 6 months or more, it might be too late. Also, to prevent long debates and misunderstandings, we should definitely emphasize that whatever coding style is chosen, it will merely be for the sake of consistency of the tutorials and by no means something official.

@certik
Copy link
Member

certik commented Jun 20, 2020 via email

@certik
Copy link
Member

certik commented Jun 20, 2020 via email

@milancurcic
Copy link
Member

I think the response will be unanimous, but we need to document it. To do that, I created a poll here:

https://fortran-lang.discourse.group/t/style-guide-for-fortran-lang-org-do-we-want-a-style-guide/134

Please cast your vote there. Don't vote in GitHub issues, it doesn't scale well for voting.

@nncarlson
Copy link
Contributor

No, I don't think it will be unanimous. What is the proposed scope of the coding style? There's a whole spectrum of things that could potentially be specified, to the point of being overbearing. Some amount of consistency across the tutorials is clearly good, but if it's too overbearing you may find that you've selected away potential contributors. I know I've seen some coding styles that I find horrendous and could not bring myself to follow.

@certik
Copy link
Member

certik commented Jun 21, 2020 via email

@awvwgk awvwgk added the section: learn Relevant for the learn section on the webpage label Aug 19, 2022
@awvwgk awvwgk transferred this issue from fortran-lang/fortran-lang.org Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
section: learn Relevant for the learn section on the webpage
Projects
None yet
Development

No branches or pull requests

8 participants