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

Robert Corbett Robert.Corbett
Thu Jul 24 22:01:56 EDT 2008


Jim Giles wrote:
>>Bill Long wrote:
>>
>>>The words I see require that the corresponding components have the same 
>>>attributes. That boils down to whether A(N) and A(N+0) have the same 
>>>dimension attribute.  I suspect the answer is yes, whether that's what 
>>>we intended or not.
>>
>>Why? If it is a constant (initialization expression), like 2+2 and 4, 
>>yes, we do clearly expect compilers to evaluate such things. Why and 
>>when have we required that equivalence of expressions involving 
>>variables (including kind parameters) be detected by compilers? If it 
>>were kind-type parameters, then they would be known at compile time and 
>>the compiler can calculate all of the dimensions and see it is the same 
>>number. Fine. But N and N+0, if N is not a constant, does not seem like 
>>something we ought to get into. IMVHO.
> 
> 
> KIND type parameters must be initialization expressions.  So all
> these expressions you've been arguing about *are* compile-time
> constants.  That is to say, the size of the array component of any 
> actual declaration of an object of the type is a static value.

That is correct.  The rules for determining equivalence of derived
types could treat kind type parameters and other type parameters
differently.  The same issues arise for nonkind type parameters,
but those issues could be resolved differently for the two cases,
because the uses of kind type parameters are much more restrictive.

The changes to the standard required by such a scheme appear to be
large, but it's just a small matter of wordsmithing.

Bob Corbett



More information about the J3 mailing list