I am struggling with making
NamedArrays more type stable. I need to implement
getindex() for the same range of slices that
AbstractArray can handle. For the backing array that NamedArrays wraps, this is easy. However, I also need to compute the names of the indices of the slices. The types of the names that survive the sliced dimensions determine the type of the resulting NamedArray. In my current implementation, the
@inferred type of such a NamedArray-slice is
Any, which is not good.
I don’t really know what operations I can use that help the type-inference, and which operation I should definitely avoid. Is there some guidance toward this?