Memory buffer type?

I thought I saw somewhere that multidimensional arrays ought to be built on top of arrays of bytes. This would be useful to me for a thing. Is this happening?

My computer doesn’t have bytes.

More seriously, you might be referring to the difference between storing a multidimensional array as a “array of arrays” vs. as a contiguous sequence of elements in memory. Julia’s multidimensional arrays use the latter format, with column-major ordering.

1 Like

Or perhaps this is about having a julia memory buffer datastructure which Array is implemented (in Julia) on top of?

You can already wrap an array around an existing memory buffer with unsafe_wrap

It strongly depend on what exactly is useful to you “for a thing”.

Array on top of user accessable byte buffer is basically the new reinterpret array. I don’t believe that’ll replace normal arrays ever since doing it means people will easily write code that can crash. It also go directly against the idea behind the reinterpret array since all tbaa will be lost.

What could happen but I don’t think is worked on by anyone is implement array on top of fixed size 1-d array. It’ll be as type safe as current implementation but might allow more direct access of the array implementation from the optimizer.

Accessing underlying storage is always possible since forever. pointer is even much more safe to use now with GC.@preserve.

Sorry, I may have been too vague. I was referring to this:

I was wondering whether that was still being planned, or abandoned?

Yes I know. That’s exactly what I’m referring to in my reply. It’s mostly an implementation detail/optimization and there’s almost nothing that’s not doable with the current implementation so it’s unclear what aspect is useful for you “for a thing”.

All right I see, I wasn’t aware of this reinterpret thing.

Thanks.