Svec not documented

Hello!

I know that it is a very “internals” thing, but svec is not documented anywhere in the docs. Also, this is rather unhelpful:

help?> Core.svec
  No documentation found.

  Core.svec is a Function.

  # built-in function; no methods

julia>

Is there any reason for this?

It’s used as a vector at certain stage when other container types in Base are not defined yet. You can find the definition here: julia/simplevector.c at b46df09eb651eba97776fe73e8044e0456e81320 · JuliaLang/julia · GitHub and the definition of Core.SimpleVector: julia/julia.h at b46df09eb651eba97776fe73e8044e0456e81320 · JuliaLang/julia · GitHub

1 Like

Yep, I could more or less know what it is.

I meant that it is not documented anywhere in the docs, and it does show up commonly when working with types and inference. For example:

julia> struct multi_param{T, U}
       q::Float64
       r::T
       s::U
       end

julia> obj2 = multi_param(8.0,9,10)
multi_param{Int64, Int64}(8.0, 9, 10)

julia> typeof(obj2).parameters
svec(Int64, Int64)

I think this should be documented, don’t you think?

.parameters is considered as a part of internal implementation, so it is potentially subject to change. Probably this is why it is not documented (too much trouble to keep it up to date and those who use it, know it’s behaviour anyway).

2 Likes