(j3.2006) Final and type-bound procedures

Van Snyder Van.Snyder
Fri Nov 30 15:05:55 EST 2012


C456 requires the passed-object dummy argument to be polymorphic if and
only if the type is extensible.  Assume we're discussing extensible
types.

C480 requires the argument of a final subroutine not to be polymorphic.

This means that the same routine cannot be both type bound and a final
subroutine.  If one needs to finalize explicitly, the final procedure
needs to be exposed as a public procedure, or one needs to write a
type-bound wrapper with a polymorphic argument, which calls the final
subroutine.

Alternatively, could C480 require that the first argument be
nonpolymorphic and of the type being defined, but allow it to be
optional, and allow additional optional arguments?  If, say, the second
were polymorphic and of the type being defined, the routine could be
type bound, with the second argument being the passed-object argument.

Is there a compelling reason that C480 requires the argument to be
nonpolymorphic and nonoptional?

In any case, why does C480 prohibit further optional arguments?

C480 could become less restrictive:

C480 (R452) A <final-subroutine-name> shall be the name of a module
procedure with at least one dummy argument. The first argument shall be
a nonpointer, nonallocatable variable of the derived type being defined.
It shall not be polymorphic if the type is not extensensible. All length
type parameters of that argument shall be assumed. That argument shall
not have the INTENT (OUT) or VALUE attribute.  Any additional arguments
shall be optional.

or

C480 (R452) A <final-subroutine-name> shall be the name of a module
procedure with at least one dummy argument. The first argument shall be
a nonpointer, nonallocatable, nonpolymorphic variable of the derived
type being defined. All length type parameters of that argument shall be
assumed. That argument shall not have the INTENT (OUT) or VALUE
attribute.  Any additional arguments shall be optional.

Does this come under the rubric of "wart," or "we should have done it
this way in the first place," or "small enough?"





More information about the J3 mailing list