What is difference between Type{T} and T

foo(::T, a::S) where {T,S} - the first argument of foo is a (non-usable) variable of type T, the second, namely a of type S.

foo(::Type{T}, a::S)- the first argument of foo is the type T, the second is of type S.

So, the difference between ::T and ::Type{T} is that they request either a variable of type T or a variable which is the type T itself. In julia types are data as well.

Indeed, this is a very basic question that is easily addressed by reading the documentation and actually running the code in question and seeing its effects.

11 Likes