Open
Description
We could consider using:
def ofDim[T](n1: Int, n2: Int)(implicit tag: ClassTag[T]): Array[Array[T]] = {
java.lang.reflect.Array.newInstance(tag.runtimeClass, n1, n2).asInstanceOf[Array[Array[T]]]
}
Or we could introduce an additional constructor to Array
that allows multiple dimensions to be specified and then update the backend to emit multinewarray
.
@DarkDimius implemented something along these lines in dotty: