You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently flags assigns each member an implicit bit position based on declaration order.
I'd like to be able to specify the bit pattern explicitly:
flags foo {
a = 0b00000001,
b = 0b00000010,
c = 0b00000100,
all = 0b00000111,
}
Motivation: Many existing APIs define flags with fixed bit values that hosts must match. WebGPU is one example—e.g. GPUColorWrite and GPUBufferUsage. Without explicit bit patterns, the host has to translate between WIT's implicit layout and the API's expected layout on every call, which negates much of the performance benefit of flags.
It's worse when the guest already uses an existing WebGPU binding (webgpu.h in C/C++, wgpu in Rust, the WebGPU API in JS): the guest sets the bit pattern the spec expects, converts it to WIT's layout, and the host converts it right back. If WIT supported explicit bit patterns, that round-trip would collapse into passing a single integer.
Activity
lukewagner commentedon Jun 15, 2026
Related discussion in #660. What do you think about the design question in this comment?
MendyBerger commentedon Jun 16, 2026
Good discussion there, and I saw you already brought up this feature request.
Closing. Let's continue the discussion in there.