Open
Description
StaticArray
uses Tuple{1,2,3}
to encode the size:
StaticArrays.jl/src/StaticArrays.jl
Lines 73 to 76 in cee335d
Arguably, the type parameters of Tuple
should be types. Otherwise, such Tuple
does not have an instance. It also confuses some users (including me when I first saw this): What does Tuple{3} mean in StaticArrays? - Usage / First steps - JuliaLang.
A better solution may be to use Tuple{StaticInteger{1},StaticInteger{2},StaticInteger{3}}
instead of Tuple{1,2,3}
. For example, a possible implementation of SArray
would be
struct SArray{N, S <: NTuple{N,StaticInteger}, T, L} <: StaticArray{S, T, N}
data::NTuple{L,T}
size::S
end
const SVector{S, T} = SArray{1, Tuple{StaticInteger{S}}, T, S}
const SMatrix{S1, S2, T, L} = SArray{2, Tuple{StaticInteger{S1}, StaticInteger{S2}}, T, L}
(Early discussion in #806 (comment))