The Go Collections working group has released proposals for new generic collection types to be included in the standard library, targeting Go 1.28. This effort seeks to expand the available data structures beyond the current limited offerings, which primarily consist of built-in slices and maps, and the heap for priority queues.
Currently, Go's standard library lacks common collection types like sets and ordered maps. Sets are typically implemented using `map[T]bool` or `map[T]struct{}`, while binary tree-based ordered maps and sets are entirely absent. The new proposals aim to fill these gaps by introducing standardized, generic implementations.
The ability to add these new collection types is made possible by the introduction of generics in Go 1.18 and iterators in Go 1.23. These language features allow library-defined types to achieve ergonomics comparable to built-in types, enabling common operations on slices and maps to be expressed as library function calls.
Specific proposals include `hash/maphash.Hasher` for custom hash functions and equivalence relations, `container/hash.Map[K,V]` for a hash-based map utilizing these custom hash functions, and `container/hash.Set[T]` for a hash-based set. These additions are intended to establish conventions for future API developments within the standard library.
✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →
One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.
One email a day. Unsubscribe in one click, any time.
Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.
▶ Play today's briefNew every morning, and the back catalogue is archived by date.
The Go Collections working group has proposed adding generic collection types, including hash-based maps and sets, to the standard library for Go 1.28. This initiative aims to provide more common data structures and establish API conventions, building on the introduction of generics in Go 1.18 and iterators in Go 1.23.