I’m not sure if I understand your proposal so my reply might not address your questions.
OffsetArray
is only one of the many array types that might have non-1-based indexing, thus dispatching my_alg(::OffsetArray)
is not a good solution.
Maybe letting AbstractArray
contain static information in its types is a good idea (AbstractArray{T,2,(1,1)}
where (1,1)
indicates the offsets), but there will be too difficult to raise this discussion in Julia and get it merged – too many things will be involved to embrace this new interface. Thus I don’t think this will happen.
Even if we’ve managed to work through it, we’ll eventually find that parametrizing the offset values might not be very helpful in practice (speaking of performance):
Oh, and the secret to supporting generic programming without much headache is to orthogonalize your design. The Base.require_one_based_indexing
is exactly such a tool to help orthogonalization.