1
0
mirror of https://github.com/golang/go synced 2024-11-26 21:11:57 -07:00

spec: clarify meaning of x op= y

Suggested by mdempsky (see also issue #11161).

Change-Id: I1ab28febe19b7a092029499015073ce8749b4d99
Reviewed-on: https://go-review.googlesource.com/10960
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Robert Griesemer 2015-06-11 13:21:46 -07:00
parent 06ef022ba3
commit 637d59859d

View File

@ -1,6 +1,6 @@
<!--{ <!--{
"Title": "The Go Programming Language Specification", "Title": "The Go Programming Language Specification",
"Subtitle": "Version of May 26, 2015", "Subtitle": "Version of June 11, 2015",
"Path": "/ref/spec" "Path": "/ref/spec"
}--> }-->
@ -4388,7 +4388,7 @@ a[i] = 23
An <i>assignment operation</i> <code>x</code> <i>op</i><code>=</code> An <i>assignment operation</i> <code>x</code> <i>op</i><code>=</code>
<code>y</code> where <i>op</i> is a binary arithmetic operation is equivalent <code>y</code> where <i>op</i> is a binary arithmetic operation is equivalent
to <code>x</code> <code>=</code> <code>x</code> <i>op</i> to <code>x</code> <code>=</code> <code>x</code> <i>op</i>
<code>y</code> but evaluates <code>x</code> <code>(y)</code> but evaluates <code>x</code>
only once. The <i>op</i><code>=</code> construct is a single token. only once. The <i>op</i><code>=</code> construct is a single token.
In assignment operations, both the left- and right-hand expression lists In assignment operations, both the left- and right-hand expression lists
must contain exactly one single-valued expression, and the left-hand must contain exactly one single-valued expression, and the left-hand