in reply to (Expert) Splicing a slice
You could alter @bar so that ->ARRAY is a pointer to the start of the slice inside @foo's ->ARRAY. Also adjust ->FILL and ->MAX. This will suffice for allowing a readable window into @foo. You must now prevent perl from doing any bad alterations to the ->ARRAY that is being pointed at. This includes preventing perl from GCing @bar prior to @foo (and then clean up @bar). If splice() is going to need ->ARRAY to be reallocated or such, you'll need to intercept that. I'm not sure that's possible.
If you marked @bar as read only then you could do your window'd arrangement without vastly too much magic. Mutable @bar will require you to know lots of details about how perl is going to handle its memory allocation and will be version dependant.
|
|---|