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

spec: explain eval order of binary operator examples with comments

Fixes #63525.

Change-Id: Ie9aa4dd47c025cd593e576c6e8de1774e1d1e302
Reviewed-on: https://go-review.googlesource.com/c/go/+/535775
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
Robert Griesemer 2023-10-16 09:08:51 -07:00 committed by Gopher Robot
parent 5873bd1d7e
commit aa05674b1d

View File

@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of Sep 13, 2023",
"Subtitle": "Version of Oct 16, 2023",
"Path": "/ref/spec"
}-->
@ -4826,12 +4826,13 @@ For instance, <code>x / y * z</code> is the same as <code>(x / y) * z</code>.
</p>
<pre>
+x
23 + 3*x[i]
x &lt;= f()
^a &gt;&gt; b
f() || g()
x == y+1 &amp;&amp; &lt;-chanInt &gt; 0
+x // x
42 + a - b // (42 + a) - b
23 + 3*x[i] // 23 + (3 * x[i])
x &lt;= f() // x &lt;= f()
^a &gt;&gt; b // (^a) >> b
f() || g() // f() || g()
x == y+1 &amp;&amp; &lt;-chanInt &gt; 0 // (x == (y+1)) && ((<-chanInt) > 0)
</pre>