← All stories
● Covered by 1 source · 1 reportMedium impact1 neutral

Go proposes generic collection types for standard library in Go 1.28

🔄 Updated 1d ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • Go Collections working group proposes new generic collection types.
  • Additions include hash-based maps and sets.
  • Proposals build on Go 1.18 generics and Go 1.23 iterators.
  • Aims to standardize common data structures in the library.

New Generic Collections Proposed

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.

Addressing Current Gaps

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.

Leveraging Recent Language Features

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.

Key Proposed Additions

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 →

The daily brief

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.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~7 min · 6 stories · Aug 15

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Reporting from

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.