]> Cypherpunks repositories - gostls13.git/commitdiff
spec: consistently use "indices" (rather than "indexes")
authorRobert Griesemer <gri@golang.org>
Mon, 10 Dec 2012 19:55:57 +0000 (11:55 -0800)
committerRobert Griesemer <gri@golang.org>
Mon, 10 Dec 2012 19:55:57 +0000 (11:55 -0800)
We have been using all three terms "indices", "indexes",
and "index expressions" indiscriminatly for index values.
With this change, "index" refers to an index value,
"indices" is the plural of "index", and "index expression"
refers to an array, slice, or map indexed by an index: a[x].

R=r, rsc, iant, ken, mtj
CC=golang-dev
https://golang.org/cl/6912056

doc/go_spec.html

index d72460da8e0c315379674a1a50c3e9182a3f7c0b..6f4e68cc9b18e41397933bd2a429faf2a87f0cf5 100644 (file)
@@ -1,6 +1,6 @@
 <!--{
        "Title": "The Go Programming Language Specification",
-       "Subtitle": "Version of December 6, 2012",
+       "Subtitle": "Version of December 10, 2012",
        "Path": "/ref/spec"
 }-->
 
@@ -791,8 +791,8 @@ The predeclared string type is <code>string</code>.
 The length of a string <code>s</code> (its size in bytes) can be discovered using
 the built-in function <a href="#Length_and_capacity"><code>len</code></a>.
 The length is a compile-time constant if the string is a constant.
-A string's bytes can be accessed by integer indices 0 through
-<code>len(s)-1</code> (§<a href="#Indexes">Indexes</a>).
+A string's bytes can be accessed by integer <a href="#Index_expressions">indices</a>
+0 through <code>len(s)-1</code>.
 It is illegal to take the address of such an element; if
 <code>s[i]</code> is the <code>i</code>'th byte of a
 string, <code>&amp;s[i]</code> is invalid.
@@ -819,8 +819,8 @@ The length is part of the array's type and must be a
 <a href="#Constant_expressions">constant expression</a> that evaluates to a non-negative
 integer value.  The length of array <code>a</code> can be discovered
 using the built-in function <a href="#Length_and_capacity"><code>len</code></a>.
-The elements can be indexed by integer
-indices 0 through <code>len(a)-1</code> (§<a href="#Indexes">Indexes</a>).
+The elements can be addressed by integer <a href="#Index_expressions">indices</a>
+indices 0 through <code>len(a)-1</code>.
 Array types are always one-dimensional but may be composed to form
 multi-dimensional types.
 </p>
@@ -850,8 +850,8 @@ SliceType = "[" "]" ElementType .
 Like arrays, slices are indexable and have a length.  The length of a
 slice <code>s</code> can be discovered by the built-in function
 <a href="#Length_and_capacity"><code>len</code></a>; unlike with arrays it may change during
-execution.  The elements can be addressed by integer indices 0
-through <code>len(s)-1</code> (§<a href="#Indexes">Indexes</a>).  The slice index of a
+execution.  The elements can be addressed by integer <a href="#Index_expressions">indices</a>
+0 through <code>len(s)-1</code>.  The slice index of a
 given element may be less than the index of the same element in the
 underlying array.
 </p>
@@ -1257,7 +1257,7 @@ For a map <code>m</code>, it can be discovered using the
 built-in function <a href="#Length_and_capacity"><code>len</code></a>
 and may change during execution. Elements may be added during execution
 using <a href="#Assignments">assignments</a> and retrieved with
-<a href="#Indexes">index</a> expressions; they may be removed with the
+<a href="#Index_expressions">index expressions</a>; they may be removed with the
 <a href="#Deletion_of_map_elements"><code>delete</code></a> built-in function.
 </p>
 <p>
@@ -2120,7 +2120,7 @@ The types of the expressions must be <a href="#Assignability">assignable</a>
 to the respective field, element, and key types of the LiteralType;
 there is no additional conversion.
 The key is interpreted as a field name for struct literals,
-an index expression for array and slice literals, and a key for map literals.
+an index for array and slice literals, and a key for map literals.
 For map literals, all elements must have a key. It is an error
 to specify multiple elements with the same field name or
 constant key value.
@@ -2480,7 +2480,7 @@ TODO: Specify what happens to receivers.
 -->
 
 
-<h3 id="Indexes">Indexes</h3>
+<h3 id="Index_expressions">Index expressions</h3>
 
 <p>
 A primary expression of the form
@@ -2596,7 +2596,7 @@ a[low : high]
 </pre>
 
 <p>
-constructs a substring or slice. The index expressions <code>low</code> and
+constructs a substring or slice. The indices <code>low</code> and
 <code>high</code> select which elements appear in the result. The result has
 indices starting at 0 and length equal to
 <code>high</code>&nbsp;-&nbsp;<code>low</code>.
@@ -2619,7 +2619,7 @@ s[2] == 4
 </pre>
 
 <p>
-For convenience, any of the index expressions may be omitted. A missing <code>low</code>
+For convenience, any of the indices may be omitted. A missing <code>low</code>
 index defaults to zero; a missing <code>high</code> index defaults to the length of the
 sliced operand:
 </p>
@@ -4010,7 +4010,7 @@ operand on the left.
 
 <p>
 The assignment proceeds in two phases.
-First, the operands of <a href="#Indexes">index expressions</a>
+First, the operands of <a href="#Index_expressions">index expressions</a>
 and <a href="#Address_operators">pointer indirections</a>
 (including implicit pointer indirections in <a href="#Selectors">selectors</a>)
 on the left and the expressions on the right are all