ford
ford copied to clipboard
Derived type extension of an abstract derived type
I have a "concrete" derived type extension of an abstract derived type. The "after contains (module level)" part of the concrete procedure and its autodoc comments don't display in the FORD-generated doc; the abstract procedure does. Neither appear on the Procedures webpage. FORD version: 6.2.4
abstract_mod.F90
!> mod_abstract module
module mod_abstract
implicit none
! ---------------------------------------------------------------
!> Abstract derived type
type, abstract, public :: abstract_t
contains
procedure(output_int_abs), deferred :: output_int !! procedure in abstract derived type
end type abstract_t
! ------------------------
!> abstract interface
abstract interface
!> subroutine in abstract interface
subroutine output_int_abs(this, an_int)
import abstract_t
implicit none
class(abstract_t), intent(in) :: this
integer, intent(in) :: an_int !! dummy variable declaration in abstract interface
end subroutine output_int_abs
end interface
end module mod_abstract
concrete_mod.F90
!> mod_concrete module
module mod_concrete
use mod_abstract, only : abstract_t
implicit none
!> concrete_t derived type
type, extends(abstract_t), public :: concrete_t
contains
!> procedure in concrete_t derived type
procedure output_int
end type concrete_t
contains
!> subroutine output_int in concrete_t
subroutine output_int(this, an_int)
implicit none
class(concrete_t), intent(in) :: this
integer, intent(in) :: an_int !! dummy variable declaration in concrete_t
write (*,*) "an_int = ", an_int
end subroutine output_int
end module mod_concrete
As to why this is an issue for me. I give two reasons. I've used concrete/abstract classes in creating a library for internal use in my organization.
- It's most natural to put autodoc comments on the concrete procedures rather than the abstract ones because many developers in my organization, while knowing Fortran, will not be familiar with abstract classes in Fortran; they might be confused by them.
- The library was designed to support multiple underlying scientific databases, which is why the concrete/abstract class structure was used. The resulting different concrete class extensions of the abstract class will, of course, share the same functionality, so having autodoc comments on the abstract procedure makes sense for this. However, there can be slight differences between the concrete procedure versions that need to be autodoc commented. It's natural to put these comments on the concrete procedures.
I could autodoc comment the procedure entries inside the concrete derived type definition, but there are many such procedures and would make the derived type definition excessively "busy." It would make it difficult to quickly glance at the derived type definition in order to see what type-bound procedures are available.
Please could you post your Ford config file? I'm not sure I can reproduce your issue. Using this minimal config file:
---
project: Example Project
src_dir: ./src
output_dir: ./doc
---
and your files:
.
├── example-project-file.md
└── src
├── abstract_mod.f90
└── concrete_mod.f90
I see the concrete output_int
on the procedures page: