Builders of the Google Go language (Golang) are exploring directions for the language’s next generation. Major themes emerging for Go 2 include support for better error-handling and generics. While Go 1 was a small team effort, Go 2 will be more community-driven. Enhancements for Go 1.13 are also under consideration.
What’s planned for Go 2
Draft designs for these two areas have been published, although more exploration is needed. Error-handling in Go has had issues with too much error-checking boilerplate code and insufficient precise error reporting. The plan under consideration involves adding a check
expression, to shorten error handling while keeping them explicit. A new handle
statement defines what actions to take when a check fails, making it easier to add precise error reporting in a single place. Additional standard interfaces for error values also may be explored.
For generics, the goal is to address the problem with writing libraries that abstract away needless type detail by allowing parametric polymorphism with type parameters. Go’s builders want to make it possible to write useful libraries for manipulating arbitrary map and channel values and write polymorphic functions that can operate on both []byte
and string
values.
Proposals for Go 2 include suggestions for significant library or language changes, including some that do not meet the Go 1 compatibility guarantee. As of late November, there were 120 issues labeled as Go 2 proposals, ranging from generic programming facilities to having only one way of declaring variables. Some related proposals have been merged.
What’s planned for Go 1.13
Go’s developers are considering the following features, culled from Go 2 proposals, for the planned Go 1.13 release:
- General Unicode identifiers, for developers using non-Western alphabets.
- Binary integer literals and support for _ in number literals, to bring Go up to par with most other languages.
- Permit signed integers as shift counts, to clean up code and get shift expressions more in sync with index expressions and the built-in functions
cap
andlen
.