Hello, Fortran community!
I hope you’re having a good day. Following up on a recent comment by @Beliavsky (Fortran Discourse, GitHub), I’m reaching out on behalf of the team starting the open-catalog repository, for your thoughts and insights on the BLOCK construct.
The BLOCK construct, introduced in the Fortran 2008 standard, offers a way to declare variables within a limited scope. I’m interested in understanding the community’s views on recommending the usage of the construct for code organization. To this end, I have a couple of areas where your insights would be invaluable:
1. Adoption of Fortran 2008 features
The Fortran 2008 standard, which introduces the BLOCK construct, seems to have broad support across various compilers (e.g., gfortran, Intel, or Cray). However, the extent of its adoption within the community is still a bit unclear to me.
I’ve encountered some discussions and resources on modern Fortran usage, such as:
- A Fortran Discourse thread on Fortran applications leveraging 2008 features.
- A Fortran Wiki entry, containing around 50% of ~40 articles that are post-2008. This hints at a trend towards modern Fortran adoption, yet I’m seeking a wider perspective.
As a result, I’d love to hear about your experiences: are you primarily working with pre- or post-2008 Fortran? This information could significantly influence whether promoting the BLOCK construct is practical.
2. Programming style
Coming from a C/C++ background, I’m curious about the programming styles preferred within the Fortran community. Quoting this user, I think it’s undeniable that:
C and Fortran are different languages which require different coding practices.
Searching for discussions around the BLOCK construct, such as this Fortran Discourse entry, opinions on BLOCK seem to vary. Some prefer traditional top declarations for consistency, suggesting the division of procedures into smaller subroutines if necessary, instead of declaring multiple scopes. Others see value in declaring variables closer to their usage. There’s also discussion regarding specific scenarios, like declarations inside loop bodies or scoping for module imports.
I would really like to know your thoughts on whether you find BLOCK of interest for your programming! To facilitate a comprehensive understanding, I’m considering setting up a poll to gather opinions, such as:
- I adhere to pre-Fortran 2008 standards, so I don’t have interest in this recommendation.
- I prefer declarations at the top, regardless of BLOCK’s availability.
- I’m open to promoting BLOCK for scoping, but I’m uncertain if I’d use it in my projects.
- I support using BLOCK for more localized declaration/import of variables and modules.
Would this be OK?
Your expertise and feedback on this would be incredibly valuable! Thank you in advance for taking the time to help us better understand the preferences of the Fortran community