I’m looking into zero-cost types for DSDL (Automatically detect zero-cost types · Issue #48 · OpenCyphal/pydsdl · GitHub)
One of the problems with this is you cannot have any variable length arrays. This will, invariably, lead to people who want to have zero-cost types defining fixed length arrays as buffers and then fill levels as integer fields. I’m wondering if we should formalize this by adding the concept of a variable fill static buffer type that is, simply, a fixed array with a fill length. The fixed array is then the maximum length of the data array and the fill is the transmitted length with the difference being padding. These types will always take up the same amount of memory both on the wire and in memory allowing for some variability within the maximum size of the static buffer but optimizing for zero-cost deserialization.