Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Using abstract procedure interfaces

zp3
Beginner
847 Views

Hi,

I'd like to ask if there are any possibilities for pointing to an abstract procedure interface from a concrete implementation to avoid redundancy. For example, I've imagined myself something like this:

module foo_mod

    abstract interface
        elemental function foo_op(a,b) result(c)
            real, intent(in) :: a,b
            real :: c
        end function foo_op
    end interface

  contains

    procedure(foo_op) foo1 !syntax is just fictional
            c=2.0*a+sqrt(b)
    end procedure foo1

    procedure(foo_op) foo2 !syntax is just fictional
            c=a/b**2
    end procedure foo2

end module foo_mod

Thanks for help!

0 Kudos
2 Replies
Steven_L_Intel1
Employee
847 Views

Nothing like that exists in Fortran today. Perhaps the closest is module procedures in submodules, but the interface has to be non-abstract.

0 Kudos
zp3
Beginner
847 Views

Ok, thanks!

I just thought such a feature might be helpful, because I have now a few more complex abstract interfaces and for each a couple of implementations. Because I am still in a very creative stage of programming, changing the interface(s) leads to a major modification in each implementation and is likely to produce inconsistencies....

0 Kudos
Reply