Currently I have a use case where I essentially need to pack AbstractVector{Bool} into the .chunks representation (i.e. each bit represent a bool value and “pad” to the smallest # of bytes that can accommodate the bits).
The easiest way is to just BitVector(my_vec).chunks, but I suppose this is technically internal. Maybe there’s a function to access the chunks of BitVector that is better than directly get that field?
Would this be a suitable role for a reinterpret(UInt64, ::BitArray) method? I’m quite sure that does not work now, but that seems pretty close to the target semantic. The main snag is that it loses the length information (padding to the next largest multiple of 64, presumably), whereas normally reinterpret is very diligent about ensuring and preserving that.
Another possibility would be parent(::BitArray), but that might be a little too much of a pun since a BitArray isn’t (semantically) a wrapped array.
With those issues, these don’t really seem any better than a.chunks.
maybe a good fix is to just document the chunks property of BitArray as public api? That’s what stat does. That seems simpler than making an accessor and declaring all existing .chunks invocations as non-blessed, and with property overloading there’s still some flexibility.