Skip to content

Packaging without polymorphism #281

Open
@rouson

Description

@rouson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions