view(b, ixs) creates a view that references the original storage a, rather than the intermediate view b. I am interested in getting the argument b back out of c, undoing the second slice.
Is there something like either
a “hard view” b, views of which remember they came from b?
a “shallow view” @shallowview that remembers it came from b?
Not builtin, no. The builtin subarray does all sorts of magic with the indices (and even the parent) such that you cannot reliably ask these questions of the builtin views.
But this could definitely be a package. This kind of “index-forward” or “process-oriented” mental model where the exact parent & indices matter just as much (or more) than the data they select is a very different view (pun intended) than the builtin takes.
True! I had forgotten where we had put all the indexing jiggery-pokery; it’s in view, not in the constructor. On the flip side, it doesn’t do indexing jiggery-pokery, so caller beware:
No bounds checks
No support for linear or logical indexing
No support for CartesianIndex or other non-integer (or non-array-of-integer) indices
Also the constructor is not described in the SubArray doc string, which however says that view is the intended way of constructing SubArray values. Giving the impression that the SubArray constructor may not be a stable interface.