Skip to content

Code style for Fortran examples in the tutorials? #60

Open
@jvdp1

Description

@jvdp1

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?

Activity

LKedward

LKedward commented on Jun 7, 2020

@LKedward
Member

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

milancurcic commented on Jun 7, 2020

@milancurcic
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

jvdp1 commented on Jun 7, 2020

@jvdp1
MemberAuthor

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

LKedward commented on Jun 7, 2020

@LKedward
Member

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

everythingfunctional commented on Jun 7, 2020

@everythingfunctional
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

certik commented on Jun 8, 2020

@certik
Member

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

smeskos commented on Jun 20, 2020

@smeskos
Contributor

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

certik commented on Jun 20, 2020

@certik
Member
certik

certik commented on Jun 20, 2020

@certik
Member
milancurcic

milancurcic commented on Jun 21, 2020

@milancurcic
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

nncarlson commented on Jun 21, 2020

@nncarlson
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

certik commented on Jun 21, 2020

@certik
Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    section: learnRelevant for the learn section on the webpage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @certik@everythingfunctional@milancurcic@nncarlson@jvdp1

        Issue actions

          Code style for Fortran examples in the tutorials? · Issue #60 · fortran-lang/webpage