Hello, gophers!

I have attempted to use the copy function for slices and found it’s API a bit 
strange. Suppose I have two slices: one of size 0 and capacity 10, the other of 
size 10 and capacity 10. When I copy the second one into the first one nothing 
happens, because the length of the first size is 0, although it could hold the 
elements just fine.

So, I am wondering why isn’t copying limited by the capacity of the destination 
slice instead? It doesn’t look natural for me to have to pad the slice with the 
default values of the type, as they will be overwritten by the copy anyway.

Thank you for the time!

-- 
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 visit 
https://groups.google.com/d/msgid/golang-nuts/0447e9ef-2daa-4fe5-b1b6-b05a5caeafeb%40Spark.

Reply via email to