Open jishnub opened 2 years ago
I know people dislike Requires for many reasons but that seems unavoidable. -- since StaticArrays is already heavy enough, maybe it doesn't matter much to add an extra Requires dependency to StaticArrays?
But this seems to be a marginal improvement to me -- I can't imagine how would people utilize this in practice. Perhaps we can just leave this issue here until someone really finds it a performance bottleneck? I'm not sure.
Yes, this isn't urgent, as it's only a performance improvement. Maybe a IsOneTo
trait in Base
will be useful, so that custom ranges might opt into that.
Perhaps this is worth considering in v1.9+ as a package extension
Currently,
no_offst_view
has special methods defined forBsae.OneTo
, but nothing forSOneTo
axes that aStaticArray
has. As a consequence,OffsetArrays
doesn't realize that aSOneTo
is 1-based. This leads tothat is, it loses the static size information. As a consequence,
One way to resolve this is to simply define
_no_offset_view
forUnion{Base.OneTo, StaticArrays.SOneTo}
over here, but this will require us to explicitly depend onStaticArrays
. The second way might be something like https://github.com/JuliaLang/julia/issues/41946, where Base definesOneTo <: AbstractOneTo
, and we define methods forAbstractOneTo
in this package. However, it doesn't appear that there's a clear direction to this inBase
at the moment. I wonder if there's another way to preserve the size, without one package explicitly depending on the other.