Automatically convert rows of a matrix to vectors


I’ve been using Julia from v0.6 but today I found this! I am very shocked! Julia will automatically convert the rows of a matrix to vectors! I know how to circumvent this, but I don’t believe I am the only one who feels uncomfortable about this.

Here’s my version info:
julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a (2023-08-24 14:43 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 20 × 12th Gen Intel(R) Core™ i7-12700H
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, alderlake)
Threads: 14 on 20 virtual cores
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =

I am confused. Which of these is surprising to you?
The first one is just usual slicing, so you lose a dimension and get back a vector. The other two use collections and so you get a Matrix as slice.
See here for more info
https://docs.julialang.org/en/v1/manual/arrays/#man-array-indexing

Oh I see it. That makes sense to me now.

Note that many people would be quite frustrated if A[3,3] returned a 1x1 Matrix{ComplexF64} rather than simply a ComplexF64. The slicing behavior that A[3,:] also “drops” a dimension to return a Vector rather than Matrix is a logical extension of this concept.

Although I suppose in absolute total generality, we could have had A[3,3] return an Array{ComplexF64,0}. But that doesn’t seem very useful. @view still does something like this, however, since it must return an array wrapper.