]> Cypherpunks repositories - gostls13.git/commitdiff
spec: simplify paragraph on certain range expressions over arrays
authorgriesemer <gri@golang.org>
Tue, 17 Oct 2017 22:30:12 +0000 (15:30 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 19 Oct 2017 00:29:56 +0000 (00:29 +0000)
Fixes #22258.

Change-Id: I43e68f1cf3163e1a041ebff2734ff2cb7943f695
Reviewed-on: https://go-review.googlesource.com/71431
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
doc/go_spec.html

index 6189db5ee6f2b5d5f4ade71d5158a9757d0e0d92..fd3830dcf04e2461230cc9fc6ca69450930f805b 100644 (file)
@@ -5028,12 +5028,10 @@ the range clause is equivalent to the same clause without that identifier.
 </p>
 
 <p>
-The range expression is evaluated once before beginning the loop,
-with one exception: if the range expression is an array or a pointer to an array
-and at most one iteration variable is present, only the range expression's
-length is evaluated; if that length is constant,
-<a href="#Length_and_capacity">by definition</a>
-the range expression itself will not be evaluated.
+The range expression <code>x</code> is evaluated once before beginning the loop,
+with one exception: if at most one iteration variable is present and
+<code>len(x)</code> is <a href="#Length_and_capacity">constant</a>,
+the range expression is not evaluated.
 </p>
 
 <p>