Currently we have @Vector for this, however, see #5207 and #6209.
Array syntax is [N]T. This is a proposal for SIMD vector syntax to be [|N|]T instead of @Vector(N, T). For example, a vector of four 32-bit integers would be [|4|]i32.
The main motivation for this would be that the compiler needs to be able to talk about primitive types in type names and in compile errors. Without syntax for this primitive type, in order to do this the compiler would introduce a dependency on the std lib such as std.meta.Vector(4, i32) which is verbose and can make compile errors and types more difficult to read at a glance, or it would have to do something like @Type(.{.Vector = .{.len = 4, .child = i32}}) which is even more verbose, making people wonder whether simd vectors really are first-class types in zig after all.
I chose | because it is already associated with bitwise operations, and because it looks OK when symmetrically positioned against the [ and ].
Related:
Currently we have
@Vectorfor this, however, see #5207 and #6209.Array syntax is
[N]T. This is a proposal for SIMD vector syntax to be[|N|]Tinstead of@Vector(N, T). For example, a vector of four 32-bit integers would be[|4|]i32.The main motivation for this would be that the compiler needs to be able to talk about primitive types in type names and in compile errors. Without syntax for this primitive type, in order to do this the compiler would introduce a dependency on the std lib such as
std.meta.Vector(4, i32)which is verbose and can make compile errors and types more difficult to read at a glance, or it would have to do something like@Type(.{.Vector = .{.len = 4, .child = i32}})which is even more verbose, making people wonder whether simd vectors really are first-class types in zig after all.I chose
|because it is already associated with bitwise operations, and because it looks OK when symmetrically positioned against the[and].Related: