The current specification for flags types allows an arbitrary (unlimited) number of labels.
For languages without a bit vector types or operator overloading (like Go), flags types with <= 64 labels can be represented as an unsigned integer type u8, u16, u32, u64. Flags can be composed with simple boolean operations, e.g.: f |= FlagFoo. For flags types with > 64 labels, the representation and user-facing API must change to a less ergonomic form. This can be seen in the Canonical ABI flattening rules for flags types, which require lowering into a sequence of i32.
If there exist limited or no current or practical applications for flags with > 64 labels, I propose we constrain flags types to at most 64 labels, and change the Canonical ABI form for types with > 32 and <= 64 labels to an i64.
Would changing the flattening rules be a breaking ABI change?
The current specification for
flagstypes allows an arbitrary (unlimited) number of labels.For languages without a bit vector types or operator overloading (like Go),
flagstypes with <= 64 labels can be represented as an unsigned integer typeu8,u16,u32,u64. Flags can be composed with simple boolean operations, e.g.:f |= FlagFoo. For flags types with > 64 labels, the representation and user-facing API must change to a less ergonomic form. This can be seen in the Canonical ABI flattening rules forflagstypes, which require lowering into a sequence ofi32.If there exist limited or no current or practical applications for
flagswith > 64 labels, I propose we constrainflagstypes to at most 64 labels, and change the Canonical ABI form for types with > 32 and <= 64 labels to ani64.Would changing the flattening rules be a breaking ABI change?