Is there a way to "forward" getindex for Tuples in a type-stable way?

It’s not directly possible, since there’s no way for the compiler to know the type of each element if you’re just iterating through them in a loop. But there are a lot of other options to make this work:

(this isn’t specific to having a wrapper around a tuple–you’ll have the same issues with regular Julia tuples too). All of these make it possible to call a function on a mixture of types in an inferable way, without necessarily implementing a type-stable getindex().

Another option would be to store FunctionWrappers instead of the objects themselves in order to create a concretely-typed collection.

4 Likes