Permalink
Browse files

spec: state which predeclared types are defined or alias types (clari…

…fication)

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 <rsc@golang.org>
  • Loading branch information...
griesemer committed Sep 19, 2017
1 parent 3dd96e9 commit 4a2391e7c965f7ed4d1ec189087293c1f6bae43c
Showing with 8 additions and 5 deletions.
  1. +8 −5 doc/go_spec.html
View
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of September 1, 2017",
"Subtitle": "Version of September 19, 2017",
"Path": "/ref/spec"
}-->
@@ -761,7 +761,8 @@ <h3 id="Boolean_types">Boolean types</h3>
<p>
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>.
and <code>false</code>. The predeclared boolean type is <code>bool</code>;
it is a <a href="#Type_definitions">defined type</a>.
</p>
<h3 id="Numeric_types">Numeric types</h3>
@@ -808,8 +809,9 @@ <h3 id="Numeric_types">Numeric types</h3>
</pre>
<p>
To avoid portability issues all numeric types are distinct except
<code>byte</code>, which is an alias for <code>uint8</code>, and
To avoid portability issues all numeric types are <a href="#Type_definitions">defined
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>.
Conversions
are required when different numeric types are mixed in an expression
@@ -825,7 +827,8 @@ <h3 id="String_types">String types</h3>
A string value is a (possibly empty) sequence of bytes.
Strings are immutable: once created,
it is impossible to change the contents of a string.
The predeclared string type is <code>string</code>.
The predeclared string type is <code>string</code>;
it is a <a href="#Type_definitions">defined type</a>.
</p>
<p>

0 comments on commit 4a2391e

Please sign in to comment.