(j3.2006) host association

Malcolm Cohen malcolm
Sun Mar 8 20:48:27 EDT 2015


<<<
Consider the module

       MODULE M
         TYPE T
           REAL(K) C
         END TYPE
         TYPE(T) X
         PARAMETER (K = KIND(0.0))
       END
>>>

We did not intend to allow this (obviously).  Why obviously?  Because the 
"previously defined" requirement makes no sense otherwise, in fact with this 
interpretatation (allow forward ref to named constant from derived type 
definitions) the requirement is completely useless and trivially bypassed e.g. 
with

   TYPE T
     REAL :: X = CONSTANT
   END TYPE
   TYPE(T),PARAMETER :: TCON = T()
    ... use TCON%X
    REAL,PARAMETER :: CONSTANT = something

Obviously (!!!) we cannot have intended that requirement to be so trivially 
bypassable.

<<<
       MODULE M1
         TYPE T
           REAL(K) C
         END TYPE
         TYPE(T) X
         PARAMETER (K = KIND(X%C))
       END
>>>

And this illustrates another reason why.  The rules are supposed to mean we 
don't get into nonsense situations.

<<<
Because the standard does not establish an interpretation for
the modified module, it is not standard conforming.
>>>

No, this demonstrates a defect in the standard.

<<<
Did I miss a constraint or restriction in the standard that the
modules violate?
>>>

Maybe not (I didn't spend too much time checking), but we certainly did not 
intend to allow such things.

As further (if weak) evidence, virtually all compilers from vendors represented 
on the committee reject it.  Quite apart from the "not making sense" aspect.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list