News for hackers. Stuff that matters.
Re:Go(lang): Robust generic functions on slices by infogulch on Friday February 23, 2024 @11:37PM (#39489160)
One detail in the latest 1.22 release is a change in the "slices" library [1] (the library is based on generics, introduced in 1.21) that helps avoid such cases:

> Functions that shrink the size of a slice (Delete, DeleteFunc, Compact, CompactFunc, and Replace) now zero the elements between the new length and the old length.

[1]: https://tip.golang.org/doc/go1.22#slices

[2]: https://pkg.go.dev/slices

There are no comments on this comment yet.