Welcome!
From Parametric Types in the manual (although the question pertains more to Parametric Methods):
it can be any type at all (or a value of any bits type)
It means that function zca can have a family of methods, like:
function zca{Int32}(o::Whiten{Int32})
function zca{Float64}(o::Whiten{Float64})
...
Note: The above code is not meant to be copied by users, it is meant for demonstration purposes only.
That (the usage of {T}
) advises the compiler to produce separate code for each method (when a different parameter gets actually used), resulting in faster code. It is easier to understand that, if you think of built-in arrays and dictionaries. They are parametric types declared as Array{T,N}
and Dict{K,V}
, where T
, N
, K
and V
initially don’t make sense, but the declarations actually mean Array{elements_type, nof_dimensions}
and Dict{keys_type, values_type}
, allowing the same names to be used for arrays of any dimension and combinations of any key-value pairs, without sacrificing performance. The names are kept short for convenience and the exact meaning is left to the way they are used by the rest of the code.
Return types are usually inferred by the compiler. If someone has to provide them, they go right after the parentheses. In your example, it would be like this:
function zca{T}(o::Whiten{T})::T