]> Cypherpunks repositories - gostls13.git/commitdiff
allow "comma ok" in initializers
authorRob Pike <r@golang.org>
Sat, 22 Aug 2009 07:04:04 +0000 (00:04 -0700)
committerRob Pike <r@golang.org>
Sat, 22 Aug 2009 07:04:04 +0000 (00:04 -0700)
DELTA=11  (4 added, 0 deleted, 7 changed)
OCL=33698
CL=33712

doc/go_spec.html

index 18357766d1192c9fd4211234f9ea0c5388ede8c1..e362b7e76b53722c5d1fec71af70c140a08d5a6b 100644 (file)
@@ -2160,12 +2160,13 @@ an otherwise legal index expression, a run-time exception occurs.
 
 <p>
 However, if an index expression on a map <code>a</code> of type <code>map[K] V</code>
-is used in an assignment of one of the special forms
+is used in an assignment or initialization of the form
 </p>
 
 <pre>
 r, ok = a[x]
 r, ok := a[x]
+var r, ok = a[x]
 </pre>
 
 <p>
@@ -2262,12 +2263,13 @@ is known only at run-time, the type of <code>x.(T)</code> is
 known to be <code>T</code> in a correct program.
 </p>
 <p>
-If a type assertion is used in an assignment of one of the special forms,
+If a type assertion is used in an assignment or initialization of the form
 </p>
 
 <pre>
 v, ok = x.(T)
 v, ok := x.(T)
+var v, ok = x.(T)
 </pre>
 
 <p>
@@ -2851,11 +2853,13 @@ f(<-ch)
 </pre>
 
 <p>
-If a receive expression is used in a tuple assignment of the form
+If a receive expression is used in an assignment or initialization of the form
 </p>
 
 <pre>
-x, ok = <-ch;  // or: x, ok := <-ch
+x, ok = <-ch
+x, ok := <-ch
+var x, ok = <-ch
 </pre>
 
 <p>