Require all arrays in struct to be of same kind and type

julia> struct Velocity{T, U<:AbstractArray{T}}
           u::U
           v::U
       end

julia> Velocity([1,2], 1:2)
ERROR: MethodError: no method matching Velocity(::Vector{Int64}, ::UnitRange{Int64})
Closest candidates are:
  Velocity(::U, ::U) where {T, U<:(AbstractArray{T})} at REPL[1]:2
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

julia> Velocity([1,2], [1,2])
Velocity{Int64, Vector{Int64}}([1, 2], [1, 2])

julia> Velocity(1:2, 1:2)
Velocity{Int64, UnitRange{Int64}}(1:2, 1:2)
5 Likes