Following on from discussions in #1782 (comment) and the WebGPU matrix chat, it has been suggested by @kainino0x that type aliases may offer a viable alternative to supporting array size as a constexpr (#1272).
@munrocket wrote in the WebGPU matrix chat:
type MyArray= array<vec2<f32>, 10>>;
// still need size somewhere
var<private> MySize = 10;
Currently there is no way to retrieve the array size for a fixed-size array, so iterating over the elements of an array with a for loop will require the array-length to be declared at least twice (once for the type MyArray, once for the for loop upper bound).
We could change arrayLength() to support both fixed-size and runtime-sized arrays. If we did this, then the MyArray type alias can be the single source of truth for the array length.