There is no any limitation, this is just syntactic feature. It is quite unusual but has some rationale behind it.
E.g. in C language int8 x[5]
reads as "x is an array of 5 int8 elements". And this one int8 y[5][4]
is "y is an array of 5 arrays of 4 int8 elements each".
Note that order of terms x
, int8
, 5
, 4
in declaration and in English explanation is not the same.
In Solidity int8[5][4] x
reads as "x is array of 4 arrays of 5 int8 elements each". You need to read backwards but order of terms is now consistent.
Go language goes one step further — it has terms in order and does not require you to read backwards: var a [5][4]int
is "variable a is array of 5 arrays of 4 int elements each".
So, "T[5] is always an array of 5 T's" means that for any type T
(be it int8
or bool[3][2]
) T[5]
will always be array of 5 elements. This is not true for some languages like C: T[5]
could be
- array of 5 ints:
int x[5]
(T is int x
)
- array of 4 arrays of ints:
int x[4][5]
(T is int x[4]
)
- ...