I want to create a parametric type that would depend on a lot of parameters (e.g. 3 integer types)
struct MyType{T<:Integer, S<:Integer, U<:Integer}
t::T
s::S
u::U
end
For the multiple dispatch I plan to use only T
. What I don’t like is that all the parameter types are printed when I work with objects of type MyType
. Also, implementing a custom Base.show
for MyType
is not enough, since if I use MyType
as a type parameter in another type (e.g. Vector
), all the 3 type parameters T, S, U
will be showed again.
Is there a workaround for this? Since I use parameter T
only for multiple dispatch, I was thinking about implementing MyType
as follows:
struct MyType{T<:Integer}
t::T
s::S where S<:Integer
u::U where U<:Integer
end
Is this implementation equivalent to the first one?