Arrays and Slices

Hey Bill,

I recently began playing around with Odin and noticed that you have incorporated slices into the language. Do you plan on having arrays automatically coerce into slices when they are passed to procedures? I know Rust does this, and I think it really helps the overall ergonomics of the language.

Edited by novus1044 on
No. To slice an array, it's really simple:

1
2
3
4
5
a: [12]int;
s: []int;
// These too are equivalent
s = a[:];
s = a[0:a.count-1];


I should note, I may change the syntax eventually from the colon `:`, to use the same as the for loops: `...` and `..<`.

This minor syntax difference isn't that important to worry about yet.

Edited by Ginger Bill on
Okay, that makes sense. Without documentation I just wasn't sure how to go about getting a slice from an array.

Thanks for the quick response. Really digging the language so far.

Edited by novus1044 on