- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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!
コピーされたリンク
2 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Nothing like that exists in Fortran today. Perhaps the closest is module procedures in submodules, but the interface has to be non-abstract.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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....