News for hackers. Stuff that matters.
Re:Go says Wat by masklinn on Saturday September 08, 2018 @06:34AM (#17940350)
> I'm not sure views into a fixed-sized array is really confusing/strange at all.

Again, as I already stated in the previous comment the issue is not the slices themselves.

It's that they're doubling up as vectors and they're shitty at it: you can share a backing buffer between mutable slices and append to both and then all hell breaks loose.

That is the issue. And that is why Rust doesn't have that issue despite having the same concept of slices: you can't grow a slice, and you can't have multiple mutable slices to the same backing buffer.

Re:Go says Wat by kodablah on Saturday September 08, 2018 @09:06AM (#17940673)
I mean, by that measure C/C++ and many others have the same problems. Your issue about lack of compiler-enforced reuse checks after invalidation is more with the language than this feature. While I agree generally, I don't see how slices are any more of a problem or surprising here than any other mutable reference that may or may not be mutated conditionally by a function.
Re:Go says Wat by masklinn on Sunday September 09, 2018 @07:52AM (#17945468)
> I mean, by that measure C/C++ and many others have the same problems.

No. C only has raw pointers so it's not trying to pretend slices are vectors, and C++ has actual functioning vectors with "slicing" being either a copy of the subvector or an iterator. Either way there is no confusion as to the capabilities of what you're given and its relation to the original data.