(j3.2006) derived types with type parameters are different

Aleksandar Donev donev1
Mon Jul 28 12:46:21 EDT 2008

Robert Corbett wrote:

>          INTERFACE S
>            SUBROUTINE S1(X)
>              TYPE T(N)
>                INTEGER, KIND :: N
In this case all of the type parameters are known at compile time, so 
simply evaluate them to get a non-parameterized type. The type appearing 
in the interface:
>              TYPE(T(2)) :: X
is not parameterized, it is a type with a specific kind parameter, so 
there should be no difference here between this example and an example 
in Fortran 90 that has INTEGER(1) and INTEGER(2) in two different 
interfaces, IMO.

>          INTERFACE S
>            SUBROUTINE S1(X, M)
>              TYPE T(N)
>                INTEGER :: N
>                SEQUENCE
>              TYPE(T(M)) :: X
These were supposedly modeled after the CHARACTER(LEN=M) case, although 
probably not verbatim. I would have thought the generic interface S is 
ambiguous and would be disallowed. But there of course CHARACTER is the 
same type by definition (an intrinsic type), not so clear to me about 
the example here.

I have no clue about the last example.
It would seem to me that two types with non-kind parameters should never 
be equivalent...and yes, I would think "cut and paste" should not work 
either, IMVHO.


More information about the J3 mailing list