Commit 462a17e0 authored by Robert Griesemer's avatar Robert Griesemer

spec: remove most §links for the now more common in-text links

Also:
- more consistenly use "xxx" statement rather than <code>xxx</code> statement
- fix/remove unnecessary links

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7821050
parent 7191ef71
...@@ -639,8 +639,8 @@ expressions</a>. ...@@ -639,8 +639,8 @@ expressions</a>.
<p> <p>
A type determines the set of values and operations specific to values of that A type determines the set of values and operations specific to values of that
type. A type may be specified by a type. A type may be specified by a
(possibly <a href="#Qualified_identifiers">qualified</a>) <i>type name</i> (possibly <a href="#Qualified_identifiers">qualified</a>)
<a href="#Type_declarations">Type declarations</a>) or a <i>type literal</i>, <a href="#Type_declarations"><i>type name</i></a> or a <i>type literal</i>,
which composes a new type from previously declared types. which composes a new type from previously declared types.
</p> </p>
...@@ -866,8 +866,8 @@ distinct arrays always represent distinct storage. ...@@ -866,8 +866,8 @@ distinct arrays always represent distinct storage.
The array underlying a slice may extend past the end of the slice. The array underlying a slice may extend past the end of the slice.
The <i>capacity</i> is a measure of that extent: it is the sum of The <i>capacity</i> is a measure of that extent: it is the sum of
the length of the slice and the length of the array beyond the slice; the length of the slice and the length of the array beyond the slice;
a slice of length up to that capacity can be created by `slicing' a new a slice of length up to that capacity can be created by
one from the original slice (§<a href="#Slices">Slices</a>). <a href="#Slices"><i>slicing</i></a> a new one from the original slice.
The capacity of a slice <code>a</code> can be discovered using the The capacity of a slice <code>a</code> can be discovered using the
built-in function <a href="#Length_and_capacity"><code>cap(a)</code></a>. built-in function <a href="#Length_and_capacity"><code>cap(a)</code></a>.
</p> </p>
...@@ -1236,8 +1236,8 @@ KeyType = Type . ...@@ -1236,8 +1236,8 @@ KeyType = Type .
</pre> </pre>
<p> <p>
The comparison operators <code>==</code> and <code>!=</code> The <a href="#Comparison_operators">comparison operators</a>
<a href="#Comparison_operators">Comparison operators</a>) must be fully defined <code>==</code> and <code>!=</code> must be fully defined
for operands of the key type; thus the key type must not be a function, map, or for operands of the key type; thus the key type must not be a function, map, or
slice. slice.
If the key type is an interface type, these If the key type is an interface type, these
...@@ -1571,8 +1571,9 @@ declarations. ...@@ -1571,8 +1571,9 @@ declarations.
<p> <p>
Labels are declared by <a href="#Labeled_statements">labeled statements</a> and are Labels are declared by <a href="#Labeled_statements">labeled statements</a> and are
used in the <code>break</code>, <code>continue</code>, and <code>goto</code> used in the <a href="#Break_statements">"break"</a>,
statements (§<a href="#Break_statements">Break statements</a>, §<a href="#Continue_statements">Continue statements</a>, §<a href="#Goto_statements">Goto statements</a>). <a href="#Continue_statements">"continue"</a>, and
<a href="#Goto_statements">"goto"</a> statements.
It is illegal to define a label that is never used. It is illegal to define a label that is never used.
In contrast to other identifiers, labels are not block scoped and do In contrast to other identifiers, labels are not block scoped and do
not conflict with identifiers that are not labels. The scope of a label not conflict with identifiers that are not labels. The scope of a label
...@@ -1872,7 +1873,7 @@ var _, found = entries[name] // map lookup; only interested in "found" ...@@ -1872,7 +1873,7 @@ var _, found = entries[name] // map lookup; only interested in "found"
<p> <p>
If a list of expressions is given, the variables are initialized If a list of expressions is given, the variables are initialized
by assigning the expressions to the variables (§<a href="#Assignments">Assignments</a>) by <a href="#Assignments">assigning</a> the expressions to the variables
in order; all expressions must be consumed and all variables initialized from them. in order; all expressions must be consumed and all variables initialized from them.
Otherwise, each variable is initialized to its <a href="#The_zero_value">zero value</a>. Otherwise, each variable is initialized to its <a href="#The_zero_value">zero value</a>.
</p> </p>
...@@ -1939,9 +1940,11 @@ a, a := 1, 2 // illegal: double declaration of a or ...@@ -1939,9 +1940,11 @@ a, a := 1, 2 // illegal: double declaration of a or
<p> <p>
Short variable declarations may appear only inside functions. Short variable declarations may appear only inside functions.
In some contexts such as the initializers for <code>if</code>, In some contexts such as the initializers for
<code>for</code>, or <code>switch</code> statements, <a href="#If_statements">"if"</a>,
they can be used to declare local temporary variables (§<a href="#Statements">Statements</a>). <a href="#For_statements">"for"</a>, or
<a href="#Switch_statements">"switch"</a> statements,
they can be used to declare local temporary variables.
</p> </p>
<h3 id="Function_declarations">Function declarations</h3> <h3 id="Function_declarations">Function declarations</h3>
...@@ -2207,7 +2210,7 @@ For array and slice literals the following rules apply: ...@@ -2207,7 +2210,7 @@ For array and slice literals the following rules apply:
</ul> </ul>
<p> <p>
Taking the address of a composite literal (§<a href="#Address_operators">Address operators</a>) <a href="#Address_operators">Taking the address</a> of a composite literal
generates a pointer to a unique instance of the literal's value. generates a pointer to a unique instance of the literal's value.
</p> </p>
<pre> <pre>
...@@ -3109,8 +3112,8 @@ occurs is implementation-specific. ...@@ -3109,8 +3112,8 @@ occurs is implementation-specific.
For unsigned integer values, the operations <code>+</code>, For unsigned integer values, the operations <code>+</code>,
<code>-</code>, <code>*</code>, and <code>&lt;&lt;</code> are <code>-</code>, <code>*</code>, and <code>&lt;&lt;</code> are
computed modulo 2<sup><i>n</i></sup>, where <i>n</i> is the bit width of computed modulo 2<sup><i>n</i></sup>, where <i>n</i> is the bit width of
the unsigned integer's type the <a href="#Numeric_types">unsigned integer</a>'s type.
<a href="#Numeric_types">Numeric types</a>). Loosely speaking, these unsigned integer operations Loosely speaking, these unsigned integer operations
discard high bits upon overflow, and programs may rely on ``wrap around''. discard high bits upon overflow, and programs may rely on ``wrap around''.
</p> </p>
<p> <p>
...@@ -3187,8 +3190,8 @@ These terms and the result of the comparisons are defined as follows: ...@@ -3187,8 +3190,8 @@ These terms and the result of the comparisons are defined as follows:
<li> <li>
Channel values are comparable. Channel values are comparable.
Two channel values are equal if they were created by the same call to <code>make</code> Two channel values are equal if they were created by the same call to
<a href="#Making_slices_maps_and_channels">Making slices, maps, and channels</a>) <a href="#Making_slices_maps_and_channels"><code>make</code></a>
or if both have value <code>nil</code>. or if both have value <code>nil</code>.
</li> </li>
...@@ -3617,8 +3620,8 @@ type <code>T</code> in any of these cases: ...@@ -3617,8 +3620,8 @@ type <code>T</code> in any of these cases:
<li> <li>
<code>x</code> is an integer constant and <code>T</code> is a <code>x</code> is an integer constant and <code>T</code> is a
<a href="#String_types">string type</a>. <a href="#String_types">string type</a>.
The same rule as for non-constant <code>x</code> applies in this case The <a href="#Conversions_to_and_from_a_string_type">same rule</a>
<a href="#Conversions_to_and_from_a_string_type">Conversions to and from a string type</a>). as for non-constant <code>x</code> applies in this case.
</li> </li>
</ul> </ul>
...@@ -3816,8 +3819,8 @@ A constant <a href="#Comparison_operators">comparison</a> always yields ...@@ -3816,8 +3819,8 @@ A constant <a href="#Comparison_operators">comparison</a> always yields
an untyped boolean constant. If the left operand of a constant an untyped boolean constant. If the left operand of a constant
<a href="#Operators">shift expression</a> is an untyped constant, the <a href="#Operators">shift expression</a> is an untyped constant, the
result is an integer constant; otherwise it is a constant of the same result is an integer constant; otherwise it is a constant of the same
type as the left operand, which must be of integer type type as the left operand, which must be of
<a href="#Arithmetic_operators">Arithmetic operators</a>). <a href="#Numeric_types">integer type</a>.
Applying all other operators to untyped constants results in an untyped Applying all other operators to untyped constants results in an untyped
constant of the same kind (that is, a boolean, integer, floating-point, constant of the same kind (that is, a boolean, integer, floating-point,
complex, or string constant). complex, or string constant).
...@@ -4440,8 +4443,7 @@ in the TypeSwitchGuard. ...@@ -4440,8 +4443,7 @@ in the TypeSwitchGuard.
</p> </p>
<p> <p>
The type in a case may be <code>nil</code> The type in a case may be <a href="#Predeclared_identifiers"><code>nil</code></a>;
<a href="#Predeclared_identifiers">Predeclared identifiers</a>);
that case is used when the expression in the TypeSwitchGuard that case is used when the expression in the TypeSwitchGuard
is a <code>nil</code> interface value. is a <code>nil</code> interface value.
</p> </p>
...@@ -4593,8 +4595,8 @@ the range clause is equivalent to the same clause with only the first variable p ...@@ -4593,8 +4595,8 @@ the range clause is equivalent to the same clause with only the first variable p
The range expression is evaluated once before beginning the loop, 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 with one exception. If the range expression is an array or a pointer to an array
and only the first iteration value is present, only the range expression's and only the first iteration value is present, only the range expression's
length is evaluated; if that length is constant by definition length is evaluated; if that length is constant
(see §<a href="#Length_and_capacity">Length and capacity</a>), <a href="#Length_and_capacity">by definition</a>,
the range expression itself will not be evaluated. the range expression itself will not be evaluated.
</p> </p>
...@@ -4872,7 +4874,7 @@ func complexF2() (re float64, im float64) { ...@@ -4872,7 +4874,7 @@ func complexF2() (re float64, im float64) {
</pre> </pre>
</li> </li>
<li>The expression list may be empty if the function's result <li>The expression list may be empty if the function's result
type specifies names for its result parameters (§<a href="#Function_types">Function types</a>). type specifies names for its <a href="#Function_types">result parameters</a>.
The result parameters act as ordinary local variables The result parameters act as ordinary local variables
and the function may assign values to them as necessary. and the function may assign values to them as necessary.
The "return" statement returns the values of these variables. The "return" statement returns the values of these variables.
...@@ -4892,8 +4894,8 @@ func (devnull) Write(p []byte) (n int, _ error) { ...@@ -4892,8 +4894,8 @@ func (devnull) Write(p []byte) (n int, _ error) {
</ol> </ol>
<p> <p>
Regardless of how they are declared, all the result values are initialized to the zero Regardless of how they are declared, all the result values are initialized to
values for their type (§<a href="#The_zero_value">The zero value</a>) upon entry to the the <a href="#The_zero_value">zero values</a> for their type upon entry to the
function. A "return" statement that specifies results sets the result parameters before function. A "return" statement that specifies results sets the result parameters before
any deferred functions are executed. any deferred functions are executed.
</p> </p>
...@@ -4910,7 +4912,9 @@ TODO: Define when return is required.<br /> ...@@ -4910,7 +4912,9 @@ TODO: Define when return is required.<br />
<p> <p>
A "break" statement terminates execution of the innermost A "break" statement terminates execution of the innermost
"for", "switch" or "select" statement. <a href="#For_statements">"for"</a>,
<a href="#Switch_statements">"switch"</a>, or
<a href="#Select_statements">"select"</a> statement.
</p> </p>
<pre class="ebnf"> <pre class="ebnf">
...@@ -4919,10 +4923,8 @@ BreakStmt = "break" [ Label ] . ...@@ -4919,10 +4923,8 @@ BreakStmt = "break" [ Label ] .
<p> <p>
If there is a label, it must be that of an enclosing If there is a label, it must be that of an enclosing
"for", "switch" or "select" statement, and that is the one whose execution "for", "switch", or "select" statement,
terminates and that is the one whose execution terminates.
<a href="#For_statements">For statements</a>, §<a href="#Switch_statements">Switch statements</a>,
§<a href="#Select_statements">Select statements</a>).
</p> </p>
<pre> <pre>
...@@ -4939,7 +4941,7 @@ L: ...@@ -4939,7 +4941,7 @@ L:
<p> <p>
A "continue" statement begins the next iteration of the A "continue" statement begins the next iteration of the
innermost "for" loop at its post statement (§<a href="#For_statements">For statements</a>). innermost <a href="#For_statements">"for" loop</a> at its post statement.
</p> </p>
<pre class="ebnf"> <pre class="ebnf">
...@@ -4949,8 +4951,7 @@ ContinueStmt = "continue" [ Label ] . ...@@ -4949,8 +4951,7 @@ ContinueStmt = "continue" [ Label ] .
<p> <p>
If there is a label, it must be that of an enclosing If there is a label, it must be that of an enclosing
"for" statement, and that is the one whose execution "for" statement, and that is the one whose execution
advances advances.
<a href="#For_statements">For statements</a>).
</p> </p>
<h3 id="Goto_statements">Goto statements</h3> <h3 id="Goto_statements">Goto statements</h3>
...@@ -5169,8 +5170,8 @@ constant and <code>s</code> is evaluated. ...@@ -5169,8 +5170,8 @@ constant and <code>s</code> is evaluated.
<p> <p>
The built-in function <code>new</code> takes a type <code>T</code> and The built-in function <code>new</code> takes a type <code>T</code> and
returns a value of type <code>*T</code>. returns a value of type <code>*T</code>.
The memory is initialized as described in the section on initial values The memory is initialized as described in the section on
<a href="#The_zero_value">The zero value</a>). <a href="#The_zero_value">initial values</a>.
</p> </p>
<pre class="grammar"> <pre class="grammar">
...@@ -5202,8 +5203,8 @@ The built-in function <code>make</code> takes a type <code>T</code>, ...@@ -5202,8 +5203,8 @@ The built-in function <code>make</code> takes a type <code>T</code>,
which must be a slice, map or channel type, which must be a slice, map or channel type,
optionally followed by a type-specific list of expressions. optionally followed by a type-specific list of expressions.
It returns a value of type <code>T</code> (not <code>*T</code>). It returns a value of type <code>T</code> (not <code>*T</code>).
The memory is initialized as described in the section on initial values The memory is initialized as described in the section on
<a href="#The_zero_value">The zero value</a>). <a href="#The_zero_value">initial values</a>.
</p> </p>
<pre class="grammar"> <pre class="grammar">
...@@ -5912,7 +5913,7 @@ Calls to <code>Alignof</code>, <code>Offsetof</code>, and ...@@ -5912,7 +5913,7 @@ Calls to <code>Alignof</code>, <code>Offsetof</code>, and
<h3 id="Size_and_alignment_guarantees">Size and alignment guarantees</h3> <h3 id="Size_and_alignment_guarantees">Size and alignment guarantees</h3>
<p> <p>
For the numeric types (§<a href="#Numeric_types">Numeric types</a>), the following sizes are guaranteed: For the <a href="#Numeric_types">numeric types</a>, the following sizes are guaranteed:
</p> </p>
<pre class="grammar"> <pre class="grammar">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment