To create a 0-d array with arr0, we can actually pass an array literal as follows
let a = arr0([0]);
This is ignored because arr0 does not check what is passed or whether it has the correct shape. First of all, I think this is bad. See the related issue: https://github.com/rust-ndarray/ndarray/issues/1253
As you can see, I don't need to pass a reference.
Now, if we attempt to create a 1d, 2d or 3d array with the similar functions, we need to pass the literal by reference, i.e. the following does not compile
0-d is always a special case, so I don't see what the action should be here. A 0-d array is very similar to a scalar, so I think its argument should be a scalar.
To create a 0-d array with
arr0
, we can actually pass an array literal as followsThis is ignored because
arr0
does not check what is passed or whether it has the correct shape. First of all, I think this is bad. See the related issue: https://github.com/rust-ndarray/ndarray/issues/1253As you can see, I don't need to pass a reference.
Now, if we attempt to create a 1d, 2d or 3d array with the similar functions, we need to pass the literal by reference, i.e. the following does not compile
The same happens with
arr2
andarr3
.Whether we decide to solve the other issue https://github.com/rust-ndarray/ndarray/issues/1253 or not, in my view, this inconsistency should not exist.
By the way, we can also do
This inconsistency is due to the fact that
arr0
acceptsA
while the other functions accept&[A]
, and I suppose we can pass references when we acceptA