It wants me to specify foo: *const [2][] const u8, even for the pointer, even for the slice
(i specially dont understand this part, isnt []...supposed to be the syntax for a slice? why does it want me to specify the array length? then it wouldn be a slice??)
but later the contents of foo may change and may want to hold other number of items.
what am i missing? is it in my understanding of arrays and slices?
In general the difference between a slice and an array is that the length of the array must be known at compile time. The length for a slice is generally not known at compile time. The zig compiler is generally quite strict. So when you try to declare a slice at compile time that has a known length it basically asks you if really want it to be a slice or an array.
Also note that in this case the slices point to constant memory, so they are basically an array.
i see, indeed adding that const works, but i dont think i understand why that is. seems like magic specially since i dont actually intend for it to be a const. But it works, and i can overwrite it like a var too. So whats the const doing?