No boundary error when indexing a slice starting at its own length
Assigning from a slice starting at its current length returns an empty slice and does not cause a boundary error:
fn void main()
{
char[] c = "abcdefgh1111111111111111111111111111111111111111";
io::printf("%s\n", c.len);
char[] data = c[48..];
io::printf("%s, %s\n", data, data=={});
}
Launching ./slice_test
48
[], true
Program completed with exit code 0.
Should it cause an error?
I was of the opinion that it should not be an error, and that the 0-length slice is fine. I will attach our last conversation about this.
I remember, I was investigating this and found that it was more or less deliberate and it's desirable to fix corner cases (and this possibly means that other .. should work as well). So maybe check that other variants work as well.
For example c[0..-1] should probably work.
I've relaxed the rules so that all of these are now allowed by default.
Please test it.