j3-fortran / fortran_proposals

Proposals for the Fortran Standard Committee
178 stars 15 forks source link

[META] Writing a code style standard like PEP8 for Fortran #118

Open Leonard-Reuter opened 4 years ago

Leonard-Reuter commented 4 years ago

Should we have a unified recommended code style standard like PEP8 for Fortran? If there is constent, that this'd be helpful, I can open a repo for it.

I found the following repo browsing the internet: Rules in 'Modern Fortran: Style and Usage' (Book) http://fortranwiki.org/fortran/show/Source+conventions https://www.fortran90.org/src/best-practices.html https://github.com/kramer314/fortran-style-guide https://github.com/compas/grasp/wiki/WIP:-Code-style-conventions

gronki commented 4 years ago

This is interesting. Could you elaborate more on this? What is this, who publishes it etc? I wonder if that would let off some pressure for "discouraging users from writing bad code" from the standarization entity.

wt., 17 gru 2019 o 16:49 Libavius notifications@github.com napisał(a):

Should we have a unified recommended code style standard like PEP8 for Fortran? The best there is atm are the Rules in 'Modern Fortran: Style and Usage'. However, this is not open-source...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/j3-fortran/fortran_proposals/issues/118?email_source=notifications&email_token=AC4NA3PT54ORTUO24WKA24DQZDYIPA5CNFSM4J35RUQKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IBCZQLQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC4NA3K5F3W2DQ6HW46VI7DQZDYIPANCNFSM4J35RUQA .

Leonard-Reuter commented 4 years ago

This is interesting. Could you elaborate more on this? What is this, who publishes it etc? I wonder if that would let off some pressure for "discouraging users from writing bad code" from the standarization entity. wt., 17 gru 2019 o 16:49 Libavius notifications@github.com napisał(a):

I just updated the original post with a link to pythons PEP8 and a few Fortran style guides I found in the internet. Most Fortran projects have their own style guide (which may be useful, since requirements can differ). However it would be good to have a unified way of writing code and then making exceptions and breaking the rules. This is especially helpful for beginners who then don't have to find rules themselves. In a repo, everybody could discuss/share his*her ideas and contribute to a summary of rules.

everythingfunctional commented 4 years ago

I would whole heartedly be in favor of this. In fact, I've put together style guides based on documents from NASA, JPL, Google, and PEP8, ProgrammingStandards.pdf. I've got several open source libraries out there in this style.

nncarlson commented 4 years ago

The guidelines in all style guides I've seen, including a couple linked here that I skimmed, fall mostly into two categories. One is "best practices", things like always use implicit none that have weighty rationale behind them. For these things I think it is possible to come to a broad community consensus, and believe a best practices guide would be extremely useful. The other category is simple style, things like don't use CamelCase for names. Everyone has some rationale for what they choose, but in the end it really boils down to personal preference. Style guides seem to consist mostly of this stuff. It is important for individual projects, but trying for broad community consensus on these types of things would be a fools errand.

septcolor commented 4 years ago

Isn't the "coding style" discussion more suited to, for example, stdlib rather than a proposal for the standard...? Because they include actual working codes, beginners can learn much from their coding style. https://github.com/fortran-lang/stdlib/issues