What do you mean by i+k >= cap(a)? k+(any non-negative number) may not
be greater than cap(a). The key to safely appending when you are unsure
of the backing array's state is to append to the slice length and
capped to the same size.

On Sun, 2019-12-01 at 14:55 -0800, Bakul Shah wrote:
> Unfortunately a[i:j:k] acts exactly like a[i:j] if i+k >= cap(a)
> and appending to subslice can mutate the underlying slice.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9788999a3d868cb34fbe1b6b59d0623dc76fe3ec.camel%40kortschak.io.

Reply via email to