I am trying to stuff quite a bit of information into parameters of a type, in the hope that dispatching on this will create efficient code. Doing this, I ran into the question of what is allowed, exactly.
Is the following correct: a value V is valid for a type parameter iff either
isbits(V)
isa(V, Symbol)
isa(V, Type)
Is there anything else?
To make things concrete, what I am trying to encode as type parameters are a return type, and a Vector{Pair{Int,Type}}. The latter does not work, but I can split the pairs, ending up two vectors, which works.
Thanks. I am not “helping” type inference, I am encoding all the information in type parameters (it does not exist anywhere else). I got the idea from a code example which converts parser spec strings to symbols, and puts them in a type parameter (can’t find the link now).
Another question I ran into is the following: given a Tuple{...}, how do I extract the type parameters? Eg from Tuple{Int,Float64}, how would I get the [Int,Float64]?