I think the change proposed here would introduce a special case by making the array length field implicitly aligned unlike other types:
We briefly discussed the possibility of introducing an opposite directive @aligned
later in v1.x (x>0), but there are certain issues that arise with variable-offset fields. Specifically, let’s suppose that your proposal is implemented. How would you suggest it handle the following:
uint3[<=16] a
@assert (_offset_ % 8).count > 1 # Yup, non byte-aligned.
# <-- Insert dynamic, runtime-computed padding here?
uint8[<=16] b
I think that explicit alignment with @align
is more aligned with the core design goals, but this is probably debatable. At any rate, this discussion should not be focused on arrays, because they are not special. There was a misguided statement made in Big-endian vs. little-endian in the context of bit-level encoding - #4 by scottdixon where it was implied that the serialization rules of variable-length arrays differ from other data types – that is not true.