Description
Using a derived type foo_t
in a module foo_m
automatically gives access to all of the type's public type-bound procedures:
use foo_m, only : foo_t
type(foo_t) foo
call foo%bar
without the need to explicitly name the public type-bound procedures (e.g., bar
) in the use
statement's only
clause. This can be very convenient in that it obviates the need to provide a potentially long list of procedures in the only
clause. However, this capability is inextricably linked to polymorphism by the requirement that the passed-object dummy argument must be declared with the keyword class
. It would be nice to have some sort of packaging mechanism that makes a collection of procedures accessible wherever a related type is accessible without also inherently enabling polymorphism, which obligates the programmer to perform runtime checks of the passed-object dummy argument's dynamic type in some situations in order to ensure type safety.