|
|
|
|
|
by db48x
1749 days ago
|
|
And that’s really the problem with it. If you want to ensure that you have exclusive access to the element(s), then you have to explicitly copy them first or you get silent data corruption. And if you want to ensure that multiple things have access to the elements, then you have to avoid reallocations or you get silent data loss. No matter what you’re doing, a pointer to an element of an array or slice is usually the wrong thing in Go. The language would be better off without them. |
|