- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nothing like that exists in Fortran today. Perhaps the closest is module procedures in submodules, but the interface has to be non-abstract.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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....
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page