(j3.2006) Abstract types, deferred bindings, generic bindings
Van Snyder
Van.Snyder
Fri Oct 2 20:12:59 EDT 2015
Consider such a module:
module :: M
type, abstract :: A(rk)
integer, kind :: RK
contains
procedure(s_d), deferred :: S_d
procedure(s_s), deferred :: S_s
generic :: S => s_d, s_s
end type A
type, extends(a) :: B
contains
procedure :: S_d => s_d_2
procedure :: S_s => s_s_2
generic :: S => s_d, s_s
end type B
abstract interface
subroutine S_d ( X )
import
integer, parameter :: RK = kind(0.0d0)
class(a(rk)), intent(inout) :: X
end subroutine S_d
subroutine S_s ( X )
import
integer, parameter :: RK = kind(0.0e0)
class(a(rk)), intent(inout) :: X
end subroutine S_s
end interface
contains
subroutine S_d_2 ( X )
integer, parameter :: RK = kind(0.0d0)
class(b(rk)), intent(inout) :: X
end subroutine S_d_2
subroutine S_s_2 ( X )
integer, parameter :: RK = kind(0.0e0)
class(b(rk)), intent(inout) :: X
end subroutine S_s_2
end module M
Is the "generic" statement allowed in both type definitions? (One of my
compilers says that's ambiguous.)
If not, should it be in the parent type, or each extension?
If it's only in the parent type, and I have a variable V of type (not
class) B, can I reference V%S?
If it's only in the extensions, and I have a variable W of class(a), can
I reference W%S?
I would have preferred that we hadn't required the interface-name on the
procedure statement with the deferred attribute if the binding-name is
the name of an accessible abstract interface, i.e., if C482 were instead
C482 (R452) If DEFERRED appears and <binding-name> is not the name of an
abstract interface [or a procedure that has an explicit
interface]?, <interface-name> shall appear.
More information about the J3
mailing list