Some languages require array types to be declared before an object of that type can be declared. In Ada, for example:
type My_Int is range 0 .. 1000;
type Index is range 11 .. 15;
type My_Int_Array is array (Index) of My_Int;
Tab : constant My_Int_Array := (2, 3, 5, 7, 11);
rather than simply
Tab : constant array(11 .. 15) of integer(0 .. 1000) := (2, 3, 5, 7, 11);
What other languages have this restriction? Is there any particularly good reason to do this, apart from just making life easier for the compiler?
constant array(11 .. 15) of integer(0 .. 1000)is quite a mouthful, so simple readability could motivate a rule to forbid non-primitive types as part of larger expressions. $\endgroup$