Hello there,

So I noticed something about the semantics of multidimensional fixed-length array vs slice initialization:

Code:

int[2][3] array;
writeln(array.length, " ", array[0].length);
int[][] slice = new int[][](2, 3);
writeln(slice.length, " ", slice[0].length);

Output:

3 2
2 3

So it seems that int[2][3] means "an array of 3 int arrays of length 2", while new int[][](2, 3) means "an array of 2 int arrays of length 3".

This seems like a direct conflict of semantics, and I was wondering whether this was an intentional design choice, or an oversight. Can anyone explain reasoning behind this?

Reply via email to