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

Aleksandar Donev donev1
Fri Jul 25 01:11:27 EDT 2008

Jim Giles wrote:

> KIND type parameters must be initialization expressions.  So all
> these expressions you've been arguing about *are* compile-time
> constants. 
OK, I missed the KIND in the example. In that case, can Robert give an 
example where it is needed to decide if two types are equivalent? It 
would seem to me that for kind type parameters the actual decision needs 
to only be made at a time when the parameter is known (since I believe 
the kind type can be unknown only in the type declaration, but not in 
any use of the type, right?). Therefore, N and N+0 no longer involve "N" 
but are rather 4 and 4 or whatever. That of course a compiler can 
(already does) and should be able to figure out.

Is it ever actually needed to know if two parameterized types are 
equivalent without knowing the KIND parameters?

Bill said:
 > expressions.  At least at the level of knowing that N and N+0 are the
 > same.  Not quite as clear for Andy's example of N*(N-1) and N*N-N.
If we are talking about compile-time constants, I don't see any 
essential or meaningful difference. They are two numbers, which may be 
the same, or different. Whether they are the same for every N, just this 
N, or no N, should not matter.

All I see is "and have type parameters and components that agree in 
order, name, and attributes." This smells to me like it has not been 
updated at all for type parameters?!? Surely, as Robert suggested, KIND 
and LENgth should be treated differently?


More information about the J3 mailing list