[go] spec: predeclared types are named, not defined types

0 views
Skip to first unread message

Robert Griesemer (Gerrit)

unread,
Mar 19, 2026, 7:11:07 PM (10 hours ago) Mar 19
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Robert Griesemer has uploaded the change for review

Commit message

spec: predeclared types are named, not defined types

We want the predeclared types (excluding any) to have unique identity.
Originally (Go 1.0), types with unique identity where named types (and
they happened to have names).

When we introduced alias declarations, we changed the terminology and
called named types (old) defined types (new). With this change, the
predeclared types became defined types.

When we introduced type parameters, we re-introduced the notion of a
named type as the (new-again) umbrella term for types with a unique
identity. But we didn't adjust the spec for predeclared types - we
kept calling them defined types.

Fix this by completing the terminology transition.
Also, clarify that the predeclared type `any` is not a named type.

Fixes #78208.
Change-Id: I13c2b8faa35e2b51958097872b1529c2aaf42c4e

Change diff

diff --git a/doc/go_spec.html b/doc/go_spec.html
index e378e0b..dbc8942 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
- "Subtitle": "Language version go1.27 (March 16, 2026)",
+ "Subtitle": "Language version go1.27 (March 20, 2026)",
"Path": "/ref/spec"
}-->

@@ -825,8 +825,11 @@
</p>

<p>
-Predeclared types, defined types, and type parameters are called <i>named types</i>.
-An alias denotes a named type if the type given in the alias declaration is a named type.
+<a href="#Predeclared_identifiers">Predeclared</a> types (excluding <code>any</code>),
+<a href="#Type_definitions">defined types</a>, and
+<a href="#Type_parameter_declarations">type parameters</a> are called <i>named types</i>.
+An <a href="#Alias_declarations">alias</a> denotes a named type if the type given in the alias declaration is a named type.
+All named types are <a href="#Type_identity">distinct</a>.
</p>

<h3 id="Boolean_types">Boolean types</h3>
@@ -835,7 +838,7 @@
A <i>boolean type</i> represents the set of Boolean truth values
denoted by the predeclared constants <code>true</code>
and <code>false</code>. The predeclared boolean type is <code>bool</code>;
-it is a <a href="#Type_definitions">defined type</a>.
+it is a <a href="#Types">named type</a>.
</p>

<h3 id="Numeric_types">Numeric types</h3>
@@ -884,8 +887,7 @@
</pre>

<p>
-To avoid portability issues all numeric types are <a href="#Type_definitions">defined
-types</a> and thus distinct except
+To avoid portability issues all numeric types are <a href="#Types">named types</a> and thus distinct except
<code>byte</code>, which is an <a href="#Alias_declarations">alias</a> for <code>uint8</code>, and
<code>rune</code>, which is an alias for <code>int32</code>.
Explicit conversions
@@ -904,7 +906,7 @@
Strings are immutable: once created,
it is impossible to change the contents of a string.
The predeclared string type is <code>string</code>;
-it is a <a href="#Type_definitions">defined type</a>.
+it is a <a href="#Types">named type</a>.
</p>

<p>
@@ -1347,7 +1349,8 @@
</pre>

<p>
-For convenience, the predeclared type <code>any</code> is an alias for the empty interface.
+For convenience, the predeclared type <code>any</code> is an alias for the empty interface;
+it is not a <a href="#Types">named type</a>.
[<a href="#Go_1.18">Go 1.18</a>]
</p>

Change information

Files:
  • M doc/go_spec.html
Change size: S
Delta: 1 file changed, 11 insertions(+), 8 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I13c2b8faa35e2b51958097872b1529c2aaf42c4e
Gerrit-Change-Number: 757120
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Griesemer <g...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Robert Griesemer (Gerrit)

unread,
Mar 19, 2026, 7:19:00 PM (10 hours ago) Mar 19
to goph...@pubsubhelper.golang.org, Alan Donovan, Ian Lance Taylor, Mark Freeman, Rob Pike, golang-co...@googlegroups.com
Attention needed from Alan Donovan, Ian Lance Taylor and Mark Freeman

Robert Griesemer voted

Code-Review+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
  • Ian Lance Taylor
  • Mark Freeman
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I13c2b8faa35e2b51958097872b1529c2aaf42c4e
Gerrit-Change-Number: 757120
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Griesemer <g...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
Gerrit-CC: Rob Pike <r...@golang.org>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: Alan Donovan <adon...@google.com>
Gerrit-Attention: Mark Freeman <markf...@google.com>
Gerrit-Comment-Date: Thu, 19 Mar 2026 23:18:55 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages