AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
Can Slices.clip Be Used to Override Existing Values?
There's a function in the experimental generic slices package, which has actually been approved to be added to go 121 next fall. It sets the capacity of the slice to whatever the current length of the slice is. And so that way, if anybody does append to it, they'll get a copy instead of rewriting the existing one. I feel like that's so much clearer. If you're reading some code and you see slices.clip, it's like, okay, that's what they're doing. They're just like making sure nobody overwrites the end of the slice. But yeah, it does look quite weird. Remove bear return. The issue number 2 1 2 9 1 proposal go