The Go blog post announces the deprecation of the go/types
package's core types in favor of using standard Go types directly. This simplifies type checking and reflection by removing a separate type system representation, making code easier to understand and maintain. Instead of using types.Int
, types.String
, etc., developers should now use int
, string
, and other built-in types when working with the go/types
package. This change improves the developer experience by streamlining interactions with types and aligning type checking more closely with the language itself. The blog post details how to migrate existing code to the new approach and emphasizes the benefits of this simplification for the Go ecosystem.
This blog post, titled "Good-bye core types; Hello Go as we know and love it," announces the deprecation of the term "core types" in Go programming language documentation and community discussions. The authors explain that the term "core types" historically referred to a specific set of predeclared, named types in Go, including numerics like int
, uint
, and float64
, as well as string
and bool
. These types held a special status because they were directly represented in the Go specification and were not defined using type aliases or other type definitions. This distinguished them from composite types like slices and maps, which are built upon these core types.
However, the post argues that this distinction between "core" and other types has become less relevant and more confusing over time. The introduction of new types like rune
and byte
(which are aliases of int32
and uint8
respectively) blurred the lines, as these new types, despite being aliases, exhibited similar behavior and importance to the original core types. Furthermore, the distinction never held much practical significance for Go programmers. The way programmers interacted with both "core" and other types was largely consistent, and the internal representation differences were not generally a concern in day-to-day coding.
The authors detail how this categorization was leading to inconsistencies and complexities within the documentation and within the language itself. For instance, the documentation sometimes used the term "basic types" interchangeably with "core types", contributing to the ambiguity. The blog post thus proposes to move away from the concept of "core types" altogether. Instead, the Go documentation will simply refer to these as "predeclared types," emphasizing that they are readily available for use without requiring explicit definition by the programmer. This simplification aims to improve clarity and reduce confusion for both new and experienced Go developers.
Finally, the post reassures readers that this change is purely terminological. The functionality and behavior of these types remain completely unchanged. No existing Go code will break as a result of this decision. The core functionality and spirit of Go, which emphasizes simplicity and ease of use, are preserved. This adjustment simply removes an unnecessary and confusing categorization, leaving the familiar and beloved aspects of Go intact. The authors encourage the community to adopt this new terminology and help make the Go ecosystem more consistent and beginner-friendly.
Summary of Comments ( 38 )
https://news.ycombinator.com/item?id=43483842
Hacker News commenters largely expressed relief and approval of Go's reversion from the proposed
coretypes
changes. Many felt the original proposal was overly complex and solved a problem most Go developers didn't have, while introducing potential performance issues and breaking changes. Some appreciated the experiment's insights into Go's type system, but ultimately agreed the added complexity wasn't worth the purported benefits. A few commenters lamented the wasted effort and questioned the decision-making process that led to the proposal in the first place, while others pointed out that exploring such ideas, even if ultimately abandoned, is a valuable part of language development. The prevailing sentiment was satisfaction with the return to the familiar and pragmatic approach that characterizes Go.The Hacker News post "Good-bye core types; Hello Go as we know and love it" (linking to a Go blog post about the removal of "core types" from the language specification) generated a moderate amount of discussion, with a mixture of opinions.
Several commenters expressed relief and approval of the change. They saw the "core types" concept as unnecessary complexity in the language specification and appreciated its removal. The simplification of the spec was seen as a positive step, making the language easier to understand and reason about. Some felt that the "core types" concept never truly added value and its removal was overdue. This sentiment was echoed by a few who suggested that the concept had caused confusion among Go developers.
A couple of commenters questioned the practical impact of the change. They wondered whether this simplification would lead to any tangible differences in how Go code is written or performs. One commenter specifically asked if this change would influence how generics are handled or used. However, there wasn't a definitive answer provided within the thread to these questions.
One commenter provided more context by linking to a GitHub issue discussing the removal of "core types". This added another layer to the conversation, though the content of that linked issue was not summarized within the Hacker News thread itself.
Finally, at least one commenter expressed a degree of apathy toward the change, stating it didn't affect their daily coding. This indicated that while some saw this as a significant simplification, others perceived it as a relatively minor detail. The overall tone of the discussion was relatively calm and technical, without any strong negativity or heated debate.