Consider the following function signature: function f(xs :: AbstractVector{T}, ::Val{U}, ::Val{V}) where {T, U, V}
. I understand the concept of value types, but I'm not certain if I understand the meaning of the prepended double-colon and I can't seem to be able to find any information specifically on this subject.
In C++ similar syntax would ensure that resolution of the name occurs from the global instead of current namespace but I'm not sure this applies to Julia (and, if it does, how). I can infer that this has to do with types since the same syntax is used to denote the type of a variable but what does it mean to have a type assignment without the assignee? TIA.
function f(xs :: AbstractVector{T}, ::Val{U}, ::Val{V}) where {T, U, V}
means that the call to f
must pass three arguments of types AbstractVector
, Val
and Val
respectively. However, you capture the value of passed variable only for the first argument xs
. The values of the second and third arguments are not captured (in this case you do not really need them as Val
is a singleton type). But you capture types T
, U
and V
, and can refer to them in the body of the function.