Summary
Web/src/docs/types/composite.md:8 describes T[] and T[N] together as "A fixed-size slice of N elements of type T":
| T[], T[N] | A fixed-size slice of N elements of type T |
T[N] is a fixed-size array, but T[] is a dynamic-length slice — the runtime layout is {data: *T, length: uint} and length is a runtime value, not a compile-time constant. The two forms have different semantics and the table description fits only the second.
Compiler reality
Rux/Include/Rux/Type.h:40 defines Kind::Slice with inner[0] as the element type and no compile-time length. The stdlib relies on the dynamic case throughout — e.g. Std/Src/String.rux:39:
func From(slice: char8[]) -> String {
let len = slice.length; // runtime field, not a compile-time constant
...
}
If T[] were really fixed-size-N, slice.length wouldn't be a meaningful runtime read.
Suggested fix
Split the row, or keep one row but name both behaviors:
| T[] | A dynamic-length slice (data pointer + runtime length) |
| T[N] | A fixed-size array of N elements of type T |
or:
| T[], T[N] | A slice (T[], dynamic length) or fixed-size array (T[N]) of T |
Summary
Web/src/docs/types/composite.md:8describesT[]andT[N]together as "A fixed-size slice ofNelements of typeT":|
T[],T[N]| A fixed-size slice ofNelements of typeT|T[N]is a fixed-size array, butT[]is a dynamic-length slice — the runtime layout is{data: *T, length: uint}andlengthis a runtime value, not a compile-time constant. The two forms have different semantics and the table description fits only the second.Compiler reality
Rux/Include/Rux/Type.h:40definesKind::Slicewithinner[0]as the element type and no compile-time length. The stdlib relies on the dynamic case throughout — e.g.Std/Src/String.rux:39:If
T[]were really fixed-size-N,slice.lengthwouldn't be a meaningful runtime read.Suggested fix
Split the row, or keep one row but name both behaviors:
|
T[]| A dynamic-length slice (data pointer + runtime length) ||
T[N]| A fixed-size array ofNelements of typeT|or:
|
T[],T[N]| A slice (T[], dynamic length) or fixed-size array (T[N]) ofT|