diff options
author | Robert Griesemer <gri@golang.org> | 2011-05-02 09:16:31 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2011-05-02 09:16:31 -0700 |
commit | ed3eeb072f22754a3bb36b4b596e9692d28e549a (patch) | |
tree | 1f96a019f4401be8c934e679c9f1e7ecc08f1e70 | |
parent | c1c234739365bb0798e7e70aed39d53ee3ef1bb1 (diff) | |
download | go-ed3eeb072f22754a3bb36b4b596e9692d28e549a.tar.gz |
go spec: restricted expressions may still be parenthesized
No language change.
- added a few examples with parentheses
- added a corresponding sentence to assignments
(this explicitly permits: (_) = 0, currently allowed by 6g,
gofmt, but marked as an error by gccgo).
R=rsc, r, iant
CC=golang-dev
http://codereview.appspot.com/4446071
-rw-r--r-- | doc/go_spec.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html index 886f89d12..e8f7894db 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,5 +1,5 @@ <!-- title The Go Programming Language Specification --> -<!-- subtitle Version of Apr 22, 2011 --> +<!-- subtitle Version of May 2, 2011 --> <!-- TODO @@ -3522,10 +3522,9 @@ Error: log.Panic("error encountered") <p> Function calls, method calls, and receive operations -can appear in statement context. +can appear in statement context. Such statements may be parenthesized. </p> - <pre class="ebnf"> ExpressionStmt = Expression . </pre> @@ -3534,6 +3533,7 @@ ExpressionStmt = Expression . h(x+y) f.Close() <-ch +(<-ch) </pre> @@ -3604,15 +3604,15 @@ assign_op = [ add_op | mul_op ] "=" . <p> Each left-hand side operand must be <a href="#Address_operators">addressable</a>, -a map index expression, -or the <a href="#Blank_identifier">blank identifier</a>. +a map index expression, or the <a href="#Blank_identifier">blank identifier</a>. +Operands may be parenthesized. </p> <pre> x = 1 *p = f() a[i] = 23 -k = <-ch +(k) = <-ch // same as: k = <-ch </pre> <p> @@ -4131,7 +4131,7 @@ case i1 = <-c1: print("received ", i1, " from c1\n") case c2 <- i2: print("sent ", i2, " to c2\n") -case i3, ok := <-c3: +case i3, ok := (<-c3): // same as: i3, ok := <-c3 if ok { print("received ", i3, " from c3\n") } else { |