Hacker News new | ask | show | jobs
by mseepgood 4997 days ago
https://gobyexample.com/slices gives the impression that arrays and slices are independent things, which is not true. A slice cannot exist without an underlying array. A slice is a window view on an array, a reference to a part of an array. Multiple slices can provide different views on the same array. When you create a completely new slice you also create a new underlying array and the window size is initially the same as the size of the array.
1 comments

Yeah there is more work to do on explaining slices for sure. I'll probably create a separate example to explain underlying arrays + capacity and perhaps break out the slicing operation into its own example. Thanks for the feedback.