I’ve got a type with six type parameters, something like this:
struct MyType{A <: S, a0, a1, B <: T, b0, b1} end
My problem is that I want access to the type parameters in functions which take MyType values as arguments.
The best way of doing this that comes to mind is this:
my_a_type(::MyType{A, a0, a1, B, b0, b1}) where {A <: S, a0, a1, B <: T, b0, b1} = A
my_a0(::MyType{A, a0, a1, B, b0, b1}) where {A <: S, a0, a1, B <: T, b0, b1} = Val(a0)
my_a1(::MyType{A, a0, a1, B, b0, b1}) where {A <: S, a0, a1, B <: T, b0, b1} = Val(a1)
my_b_type(::MyType{A, a0, a1, B, b0, b1}) where {A <: S, a0, a1, B <: T, b0, b1} = B
my_b0(::MyType{A, a0, a1, B, b0, b1}) where {A <: S, a0, a1, B <: T, b0, b1} = Val(b0)
my_b1(::MyType{A, a0, a1, B, b0, b1}) where {A <: S, a0, a1, B <: T, b0, b1} = Val(b1)
But this is repetitive, especially as the parameter names would be longer in real code. Is there a better way, perhaps?