Skip to content

Commit 4a2391e

Browse files
committed
spec: state which predeclared types are defined or alias types (clarification)
When we introduced the distinction between "defined" and "alias" types we retained the notion of a "named" type (any type with a name). The predeclared types (which all have names) simply remained named types. This CL clarifies the spec by stating excplicitly which predeclared types are defined types (or at least "act" like defined types), and which ones are alias types. Fixes #21785. Change-Id: Ia8ae133509eb5d738e6757b3442c9992355e3535 Reviewed-on: https://go-review.googlesource.com/64591 Reviewed-by: Russ Cox <[email protected]>
1 parent 3dd96e9 commit 4a2391e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

doc/go_spec.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Version of September 1, 2017",
3+
"Subtitle": "Version of September 19, 2017",
44
"Path": "/ref/spec"
55
}-->
66

@@ -761,7 +761,8 @@ <h3 id="Boolean_types">Boolean types</h3>
761761
<p>
762762
A <i>boolean type</i> represents the set of Boolean truth values
763763
denoted by the predeclared constants <code>true</code>
764-
and <code>false</code>. The predeclared boolean type is <code>bool</code>.
764+
and <code>false</code>. The predeclared boolean type is <code>bool</code>;
765+
it is a <a href="#Type_definitions">defined type</a>.
765766
</p>
766767

767768
<h3 id="Numeric_types">Numeric types</h3>
@@ -808,8 +809,9 @@ <h3 id="Numeric_types">Numeric types</h3>
808809
</pre>
809810

810811
<p>
811-
To avoid portability issues all numeric types are distinct except
812-
<code>byte</code>, which is an alias for <code>uint8</code>, and
812+
To avoid portability issues all numeric types are <a href="#Type_definitions">defined
813+
types</a> and thus distinct except
814+
<code>byte</code>, which is an <a href="#Alias_declarations">alias</a> for <code>uint8</code>, and
813815
<code>rune</code>, which is an alias for <code>int32</code>.
814816
Conversions
815817
are required when different numeric types are mixed in an expression
@@ -825,7 +827,8 @@ <h3 id="String_types">String types</h3>
825827
A string value is a (possibly empty) sequence of bytes.
826828
Strings are immutable: once created,
827829
it is impossible to change the contents of a string.
828-
The predeclared string type is <code>string</code>.
830+
The predeclared string type is <code>string</code>;
831+
it is a <a href="#Type_definitions">defined type</a>.
829832
</p>
830833

831834
<p>

0 commit comments

Comments
 (0)