4 ms·
The main mistake in this article is the assumption that b := a makes 'b' an "alias" of 'a'. It doesn't. It creates a new slice that starts off pointing to the s
by iand 11y ago
The main mistake in this article is the assumption that b := a makes 'b' an "alias" of 'a'. It doesn't. It creates a new slice that starts off pointing to the same array as 'a'. Also slices are immutable so you can't change 'a'. If you create a new slice by manipulating 'a' then the copy 'b' won't see anything outside of its bounds.