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

Allow ABSTRACT INTERFACE to define submodule procedure interfaces #120

Open
qolin1 opened this issue Dec 21, 2019 · 2 comments
Open

Allow ABSTRACT INTERFACE to define submodule procedure interfaces #120

qolin1 opened this issue Dec 21, 2019 · 2 comments
Labels
Clause 15 Standard Clause 15: Procedures

Comments

@qolin1
Copy link

qolin1 commented Dec 21, 2019

Consider a series of procedures in a number of SUBMODULEs. Each procedure requires its interface to be defined in the ancestor module.

The following refers to code in the ancestor module only, It does not refer to any changes in the submodules.

If many of these procedures have an identical interface (apart from the procedure name), it would be useful if the interfaces could be defined in a single ABSTRACT INTERFACE, and the resulting named interface used in subsequent PROCEDURE statements.

I asked in the Intel Fortran Forum if this were possible, but it appears it is not: see https://software.intel.com/en-us/forums/intel-fortran-compiler/topic/842383

I have attached the example file showing my existing code.

test.f90.txt

@sblionel
Copy link
Member

This really isn't related to submodules - what you'd like to do is use PROCEDURE(abstract_interface) instead of SUBROUTINE/FUNCTION in an interface block or a procedure definition. I can think of uses for this without submodules. (Note that in a submodule, you can simply say MODULE PROCEDURE xxx with the interface having been defined in the parent module.)

Given that compilers already have to support MODULE PROCEDURE, I don't see this as a difficult thing. The downside is that a reader has to go looking elsewhere for the declarations of the dummy arguments, something I find annoying.

@Jellby
Copy link

Jellby commented Sep 25, 2020

The downside is that a reader has to go looking elsewhere for the declarations of the dummy arguments, something I find annoying.

Not more annoying than having to repeat and modify the same dummy argument declaration tens of times. Without this feature, the developer will use preprocessor include files... which doesn't make it less annoying for the reader.

@certik certik added the Clause 15 Standard Clause 15: Procedures label Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clause 15 Standard Clause 15: Procedures
Projects
None yet
Development

No branches or pull requests

4 participants