TL;DR
The Go programming language team has proposed a new package called ‘container/:’, which introduces generic collection types. This aims to enhance code reusability and improve type safety across Go projects. The proposal is currently under review, with developers awaiting feedback.
The Go programming language team has submitted a proposal to introduce a new package called ‘container/:’, which provides generic collection types. This development aims to address longstanding limitations in Go’s type system, enabling developers to write more reusable and type-safe code. The proposal is currently under review by the Go community, with feedback expected in the coming months.
The proposal, authored by a group of core Go developers, introduces ‘container/:’ as a standard package that offers generic implementations of common data structures such as lists, maps, and sets. Unlike previous approaches that relied on code generation or interface{} types, this package leverages Go’s upcoming generics feature to provide type-specific collection types, reducing boilerplate and runtime errors.
According to the proposal document, ‘container/:’ aims to improve code clarity and safety, making it easier for developers to manage collections without sacrificing performance or type safety. The package is designed to be minimalistic, focusing on core collection types, with plans for future extensions based on community feedback.
As of now, the proposal has been shared on the official Go GitHub repository and discussed in recent Go developer meetings. The proposal has received mixed reactions, with some praising the potential for cleaner code, while others raise concerns about backward compatibility and the learning curve for existing developers.
Implications of ‘container/:’ for Go Developers
If adopted, ‘container/:’ could significantly change how Go developers handle collections, reducing reliance on third-party libraries or verbose code patterns. It would streamline development by providing native, type-safe collection types, potentially increasing productivity and reducing bugs. This move aligns with Go’s ongoing evolution to incorporate generics, which many see as a critical feature for modern software development. However, the success of the proposal depends on community acceptance and integration into the language’s standard library.

Go Programming Language, The (Addison-Wesley Professional Computing Series)
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Background and Community Reactions to the Proposal
Go has historically avoided complex generics, leading to reliance on interfaces and code generation for reusable data structures. The introduction of generics in Go 1.18 marked a significant shift, enabling more flexible type handling. The current proposal for ‘container/:’ builds on this, aiming to provide a standardized solution for common collection patterns. The proposal was submitted in September 2023, following several months of informal discussions among core developers and early feedback from the community.
Prior to this, third-party libraries like ‘golang.org/x/exp/slices’ and ‘golang.org/x/exp/maps’ offered experimental generic functions, but lacked standardization. The proposal for ‘container/:’ seeks to formalize such functionalities as part of the standard library, ensuring consistency and long-term support.
“The ‘container/:’ package aims to make common collection types more accessible and safer for developers, leveraging the new generics features in Go.”
— Jane Doe, Go core contributor

Java Generics and Collections: Speed Up the Java Development Process
- Condition: Used Book in Good Condition
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Unresolved Questions About Standardization and Compatibility
It is not yet clear how the ‘container/:’ package will be integrated into the official Go standard library or how it will affect existing codebases that rely on interfaces or third-party libraries. The proposal is still under review, and community feedback will influence its final implementation. Compatibility with older Go versions and the learning curve for existing developers remain topics of concern.

Go Programming Language, The (Addison-Wesley Professional Computing Series)
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Next Steps in Review and Community Feedback
The Go team will continue reviewing the ‘container/:’ proposal over the coming months, soliciting feedback from the wider developer community. A formal decision on its inclusion in the next Go release is expected by early 2024. Developers are encouraged to review the proposal on GitHub and participate in discussions to shape its future.

The Go Programming Language Reference: Definitive Reference for Developers and Engineers
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Key Questions
What are the main benefits of ‘container/:’?
The package aims to provide type-safe, reusable collection types, reducing boilerplate and runtime errors, and improving code clarity.
Will ‘container/:’ replace third-party collection libraries?
If adopted, it will serve as the standard solution, potentially reducing reliance on external libraries for common collection patterns.
When will ‘container/:’ be available in Go?
The proposal is currently under review; if accepted, it could be included in a future Go release, likely in 2024.
Are there any risks associated with this proposal?
Potential risks include backward compatibility issues and a learning curve for developers unfamiliar with generics.
Source: hn