I am working on Julia 1.3 and find we can have Number
s, Symbol
s and Char
s, etc., as type parameters, but they cannot be String
s, Cmd
s, etc.
julia> struct A{T}
end
julia> A{333}()
A{333}()
julia> A{"fd"}()
ERROR: TypeError: in Type, in parameter, expected Type, got String
Stacktrace:
[1] top-level scope at REPL[5]:1
julia> A{:fd}()
A{:fd}()
julia> A{1.0}()
A{1.0}()
julia> x = complex(1,2)
1 + 2im
julia> A{x}()
A{1 + 2im}()
julia> A{`run`}()
ERROR: TypeError: in Type, in parameter, expected Type, got Cmd
Stacktrace:
[1] top-level scope at REPL[16]:1
What is the reason behind that? What other type of values can we use for type parameters?