Open hyrodium opened 1 year ago
I don't really like SA
either. I wouldn't make any formal deprecation but I think rewriting README.md to promote @SArray
/@MArray
as the primary convenient way of making static arrays is a good idea.
@SVector
is used in so many packages that JuliaHub gives up shortly after reaching letter "C": https://juliahub.com/ui/Search?q=%40SVector&type=code .
Okay, I will open a PR to update the docs not to encourage @SVector
, @SMatrix
, and SA[...]
. :+1:
Has there been any progress regarding this issue? Personally, I am convinced by the arguments above and will stick only to @SArray
and @MArray
from now on.
OTOH, the other macros are widely used and we need a long deprecation phase. So better start early :)
The
SA
notation was introduced in https://github.com/JuliaArrays/StaticArrays.jl/pull/633, and@SArray
macro exists from the beginning. Both features have the same purpose: "Provide simple ways to constructSArray
!".I now think it would be nice to deprecate the methods other than
@SArray
. Here's why:Disadvantages with
SA[...]
SA[;;;]
is not correct.SA
and reduce the maintenance cost.@SArray [;;;]
works fine. (x-ref: https://github.com/JuliaArrays/StaticArrays.jl/pull/1009)SA[1,2,3]
is not consistent withFloat64[1,2,3]
etc.SA
seems hacky to me just likeTuple{1,2,3}
(https://github.com/JuliaArrays/StaticArrays.jl/issues/807)SA[...]
createsSArray
, but no similar features forMArray
.@MArray [1 2;3 4]
is shorter thanMMatrix(SA[1 2; 3 4])
. (https://github.com/JuliaArrays/StaticArrays.jl/issues/691#issuecomment-555338011)SA[i for i in 1:3]
is not supported.@SVector [i for i in 1:3]
works.@SArray rand(3)
etc.Disadvantages with
@SVector
and@SMatrix
@SArray
is enough. No additional benefits.Disadvantages with
@SArray
@SArray [1,2,3]
needs more keystrokes thanSA[1,2,3]