(no title)
nicksardo | 10 years ago
What scares you is the possibility that the underlying array may be copied to a newer, larger array giving enough space for the appended items. If there exists enough space, why bother with a new allocation? I want `append` to handle this for me. If you want different behavior, you can easily setup your own design with `copy`
Regarding this blog post, if you have multiple slices to the same array and are arbitrarily appending to any of those slices, then your design is wrong to begin with.
This isn't an edge-case but a lack of slice understanding.
karmakaze|10 years ago
a-nom-a-ly|10 years ago
tshadwell|10 years ago
[-] http://golang.org/ref/spec#Appending_and_copying_slices
skj|10 years ago
The slice returned only points to a new array when the capacity is not large enough to fit additional values.
a-nom-a-ly|10 years ago