fortran-lang / webpage

New Fortran webpage
https://fortran-lang.org/en
MIT License
47 stars 39 forks source link

Code style for Fortran examples in the tutorials? #60

Open jvdp1 opened 4 years ago

jvdp1 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

I agree, let's start a poll if we want a coding style to be used in tutorials.

I vote yes.

On Sat, Jun 20, 2020, at 11:00 AM, smeskos wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fortran-lang/webpage/issues/60, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFAWF6K4NPM6IMNDTAE3DRXTTLHANCNFSM4NXCUEKA.

certik commented 4 years ago

To clarify the question I am voting yes is:

Do I prefer to have a coding style agreed upon by the community even if it might contain some things that I personally do not like?

On Sat, Jun 20, 2020, at 2:24 PM, Ondřej Čertík wrote:

I agree, let's start a poll if we want a coding style to be used in tutorials.

I vote yes.

On Sat, Jun 20, 2020, at 11:00 AM, smeskos wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fortran-lang/webpage/issues/60, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFAWF6K4NPM6IMNDTAE3DRXTTLHANCNFSM4NXCUEKA.

milancurcic commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

I agree. The question is unfortunately formulated. I think it should ask: should we try to agree on code formatting conventions for tutorials?

So voting yes can still mean voting no later if the convention that most voted for is unacceptable to you. And if we can't reach a consensus I don't think we should be forcing it on everybody.

The question is, should we even try to find a consensus?

On Sun, Jun 21, 2020, at 4:49 PM, Neil Carlson wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fortran-lang/webpage/issues/60, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAFAWAFXR6ISATHM2UTXK3RX2FABANCNFSM4NXCUEKA.