Is this a bug? I’d actually have expected the construction attempt to throw. Couldn’t find any issues on Github, but I can’t think of a rationale for this behavior.
Alternatively, perhaps it’d be good to normalize the shape, so the result of Array{Int}(undef, 0, 1) would be the same as for Array{Int}(undef, 0, 0)?
Why would it throw or change the shape from what the user requested? A 0x1 matrix is perfectly valid.
For a practical example of where the difference between 0x0 and 0x1 matters, hcat(ones(0,1), ones(1,1)) works, but hcat(ones(0,0), ones(1,1)) will throw a `DimmensionMismatch.
Of possible interest: the plotting example “making waves” uses this with:
...
zs = zeros(0, 40)
...
@gif for i in range(0, stop = 2π, length = n)
...
# add to and show the tracked values over time
global zs = vcat(zs, z')
...
end
It’s convenient to initialise the time series data as a 0x40 matrix.