Skip to content

Commit 17083a2

Browse files
committed
spec: retitle section on "Assignments" to "Assignment statements"
This permits a clear distinction between an individual assignment and an assignment statement which may assign more than one value. It also makes this section title consistent with all other section titles about statements. Adjust internal links and prose where appropriate. (Note that the spec already referred to assignment statements in a couple of places, even before this change.) Add an introductory paragraph to the section on assignment statements. Preparation for adding a section on value vs reference types (issue #5083). Change-Id: Ie140ac296e653c67da2a5a203b63352b3dc4f9f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/413615 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
1 parent 4d95fe6 commit 17083a2

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

doc/go_spec.html

+22-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Version of June 21, 2022",
3+
"Subtitle": "Version of June 29, 2022",
44
"Path": "/ref/spec"
55
}-->
66

@@ -263,7 +263,7 @@ <h3 id="Operators_and_punctuation">Operators and punctuation</h3>
263263

264264
<p>
265265
The following character sequences represent <a href="#Operators">operators</a>
266-
(including <a href="#Assignments">assignment operators</a>) and punctuation:
266+
(including <a href="#Assignment_statements">assignment operators</a>) and punctuation:
267267
</p>
268268
<pre class="grammar">
269269
+ &amp; += &amp;= &amp;&amp; == != ( )
@@ -676,7 +676,7 @@ <h2 id="Constants">Constants</h2>
676676
A constant may be given a type explicitly by a <a href="#Constant_declarations">constant declaration</a>
677677
or <a href="#Conversions">conversion</a>, or implicitly when used in a
678678
<a href="#Variable_declarations">variable declaration</a> or an
679-
<a href="#Assignments">assignment</a> or as an
679+
<a href="#Assignment_statements">assignment statement</a> or as an
680680
operand in an <a href="#Expressions">expression</a>.
681681
It is an error if the constant value
682682
cannot be <a href="#Representability">represented</a> as a value of the respective type.
@@ -780,7 +780,7 @@ <h2 id="Variables">Variables</h2>
780780
<p>
781781
A variable's value is retrieved by referring to the variable in an
782782
<a href="#Expressions">expression</a>; it is the most recent value
783-
<a href="#Assignments">assigned</a> to the variable.
783+
<a href="#Assignment_statements">assigned</a> to the variable.
784784
If a variable has not yet been assigned a value, its value is the
785785
<a href="#The_zero_value">zero value</a> for its type.
786786
</p>
@@ -1591,7 +1591,7 @@ <h3 id="Map_types">Map types</h3>
15911591
For a map <code>m</code>, it can be discovered using the
15921592
built-in function <a href="#Length_and_capacity"><code>len</code></a>
15931593
and may change during execution. Elements may be added during execution
1594-
using <a href="#Assignments">assignments</a> and retrieved with
1594+
using <a href="#Assignment_statements">assignments</a> and retrieved with
15951595
<a href="#Index_expressions">index expressions</a>; they may be removed with the
15961596
<a href="#Deletion_of_map_elements"><code>delete</code></a> built-in function.
15971597
</p>
@@ -1634,7 +1634,7 @@ <h3 id="Channel_types">Channel types</h3>
16341634
<i>send</i> or <i>receive</i>. If a direction is given, the channel is <i>directional</i>,
16351635
otherwise it is <i>bidirectional</i>.
16361636
A channel may be constrained only to send or only to receive by
1637-
<a href="#Assignments">assignment</a> or
1637+
<a href="#Assignment_statements">assignment</a> or
16381638
explicit <a href="#Conversions">conversion</a>.
16391639
</p>
16401640

@@ -2241,7 +2241,7 @@ <h3 id="Blank_identifier">Blank identifier</h3>
22412241
The <i>blank identifier</i> is represented by the underscore character <code>_</code>.
22422242
It serves as an anonymous placeholder instead of a regular (non-blank)
22432243
identifier and has special meaning in <a href="#Declarations_and_scope">declarations</a>,
2244-
as an <a href="#Operands">operand</a>, and in <a href="#Assignments">assignments</a>.
2244+
as an <a href="#Operands">operand</a>, and in <a href="#Assignment_statements">assignment statements</a>.
22452245
</p>
22462246

22472247

@@ -2748,7 +2748,7 @@ <h3 id="Variable_declarations">Variable declarations</h3>
27482748

27492749
<p>
27502750
If a list of expressions is given, the variables are initialized
2751-
with the expressions following the rules for <a href="#Assignments">assignments</a>.
2751+
with the expressions following the rules for <a href="#Assignment_statements">assignment statements</a>.
27522752
Otherwise, each variable is initialized to its <a href="#The_zero_value">zero value</a>.
27532753
</p>
27542754

@@ -3011,7 +3011,7 @@ <h3 id="Operands">Operands</h3>
30113011

30123012
<p>
30133013
The <a href="#Blank_identifier">blank identifier</a> may appear as an
3014-
operand only on the left-hand side of an <a href="#Assignments">assignment</a>.
3014+
operand only on the left-hand side of an <a href="#Assignment_statements">assignment statement</a>.
30153015
</p>
30163016

30173017
<p>
@@ -3821,7 +3821,7 @@ <h3 id="Index_expressions">Index expressions</h3>
38213821

38223822
<p>
38233823
An index expression on a map <code>a</code> of type <code>map[K]V</code>
3824-
used in an <a href="#Assignments">assignment</a> or initialization of the special form
3824+
used in an <a href="#Assignment_statements">assignment statement</a> or initialization of the special form
38253825
</p>
38263826

38273827
<pre>
@@ -4037,7 +4037,7 @@ <h3 id="Type_assertions">Type assertions</h3>
40374037
</pre>
40384038

40394039
<p>
4040-
A type assertion used in an <a href="#Assignments">assignment</a> or initialization of the special form
4040+
A type assertion used in an <a href="#Assignment_statements">assignment statement</a> or initialization of the special form
40414041
</p>
40424042

40434043
<pre>
@@ -5194,7 +5194,7 @@ <h3 id="Receive_operator">Receive operator</h3>
51945194
</pre>
51955195

51965196
<p>
5197-
A receive expression used in an <a href="#Assignments">assignment</a> or initialization of the special form
5197+
A receive expression used in an <a href="#Assignment_statements">assignment statement</a> or initialization of the special form
51985198
</p>
51995199

52005200
<pre>
@@ -5942,7 +5942,7 @@ <h3 id="IncDec_statements">IncDec statements</h3>
59425942
</pre>
59435943

59445944
<p>
5945-
The following <a href="#Assignments">assignment statements</a> are semantically
5945+
The following <a href="#Assignment_statements">assignment statements</a> are semantically
59465946
equivalent:
59475947
</p>
59485948

@@ -5953,7 +5953,14 @@ <h3 id="IncDec_statements">IncDec statements</h3>
59535953
</pre>
59545954

59555955

5956-
<h3 id="Assignments">Assignments</h3>
5956+
<h3 id="Assignment_statements">Assignment statements</h3>
5957+
5958+
<p>
5959+
An <i>assignment</i> replaces the current value stored in a <a href="#Variables">variable</a>
5960+
with a new value specified by an <a href="#Expressions">expression</a>.
5961+
An assignment statement may assign a single value to a single variable, or multiple values to a
5962+
matching number of variables.
5963+
</p>
59575964

59585965
<pre class="ebnf">
59595966
Assignment = ExpressionList assign_op ExpressionList .
@@ -6522,7 +6529,7 @@ <h4 id="For_range">For statements with <code>range</code> clause</h4>
65226529

65236530
<p>
65246531
The iteration values are assigned to the respective
6525-
iteration variables as in an <a href="#Assignments">assignment statement</a>.
6532+
iteration variables as in an <a href="#Assignment_statements">assignment statement</a>.
65266533
</p>
65276534

65286535
<p>

0 commit comments

Comments
 (0)