4 ms·
> but it doesn't even have map/filter/reduce/forEach as generic implementations for all data types. Generics landed in the latest stable version, 4 months ago.
by PhilippGille 4y ago
> but it doesn't even have map/filter/reduce/forEach as generic implementations for all data types.
Generics landed in the latest stable version, 4 months ago. Before doing too many too early additions in the stdlib they want to observe how generics are used in the wild. I don't have the link handy, but it was mentioned in one of the generics discussions (issue on GitHub).
In these cases (another case was error wrapping prior Go 1.13) they start with experimental libraries in `golang.org/x/exp/...`, which they did here as well:
https://pkg.go.dev/golang.org/x/exp/slices https://pkg.go.dev/golang.org/x/exp/slices
https://pkg.go.dev/golang.org/x/exp/maps https://pkg.go.dev/golang.org/x/exp/maps
So while the stdlib doesn't have the functions you're looking for yet, this might change over time.
- kgeist 4y ago>they want to observe how generics are used in the wild. I don't have the link handy, but it was mentioned in one of the generics discussions (issue on GitHub). The rationale can be found here: https://github.com/golang/go/issues/48918 https://github.com/golang/go/issues/48918