GENERIC statement

Standard: F77 F90 F95 F2003 F2008


<Syntax>

The GENERIC statement declares a generic type-bound procedure, which is a set of specific type-bound procedures with a generic identifier; it only appears in the “type-bound procedure part” of a type definition.

generic-type-bound-procedure ::= GENERIC [ , access ] :: generic-spec => type-bound-procedure-name-list
access ::= PRIVATE | PUBLIC
type-bound-procedure-name-list ::= type-bound-procedure-name [ , type-bound-procedure-name ]...

generic-spec ::= name
| ASSIGNMENT (=)
| OPERATOR (operator)
| read-or-write (form)

read-or-write ::= READ | WRITE
form ::= FORMATTED | UNFORMATTED

For full syntax and semantics, see the type-bound procedure page.

<Semantics>

Each generic type-bound procedure statement either defines a new type-bound generic or extends an existing type-bound generic. If a type-bound generic is an operator or assignment, the PASS attribute is required on each specific type-bound procedure, and is used to determine which object is the invoking object. Note that unlike operators, assignment and defined i/o defined by an INTERFACE block, type-bound operators, assignment and defined i/o are always accessible whenever an object of the type is accessible, i.e. they are not blocked by the ONLY clause on a USE statement.

<Related>

CLASS specifier, Component definition statement, Derived Type Definition, EXTENDS clause, INTERFACE ASSIGNMENT statement, INTERFACE OPERATOR statement, NOPASS attribute, PASS attribute, PRIVATE attribute, PUBLIC attribute, TYPE statement