Slices that have a compile-time known length are under the hood just a single-item pointer to an array. In contrast, a slice that have a runtime known length is a really a slice object. Is a good idea to include a section in the book to describe this, because:
runtime known slices can't be used on vectors.
only compile-time known slices support the .* syntax, because they are pointers. Runtime known slices are not pointers, and therefore, do not support this syntax.
if you want to copy a runtime known slice to another location, you use @memcpy(), while compile-time known slices can be copied with the .* syntax.
Slices that have a compile-time known length are under the hood just a single-item pointer to an array. In contrast, a slice that have a runtime known length is a really a slice object. Is a good idea to include a section in the book to describe this, because:
.*
syntax, because they are pointers. Runtime known slices are not pointers, and therefore, do not support this syntax.@memcpy()
, while compile-time known slices can be copied with the.*
syntax.More details on: https://ziglang.org/documentation/master/#Slices