From 4ed666e228bda4ab8a8c05719678968e0c4049ef Mon Sep 17 00:00:00 2001
From: Robert Griesemer
-The length is part of the array's type and must must be a constant
-expression (§Constant expressions) that evaluates to a non-negative
+The length is part of the array's type and must must be a
+constant expression that evaluates to a non-negative
integer value. The length of array
Similarly, consider this interface specification,
-which appears within a type declaration (§Type declarations)
+which appears within a type declaration
to define an interface called
calls
@@ -2547,7 +2547,7 @@ be replaced by a bitwise "and" operation:
a
can be discovered
using the built-in function len(a)
, which is a
compile-time constant. The elements can be indexed by integer
@@ -881,7 +881,7 @@ interface { }
Lock
:
const (
- bit0, mask0 = 1 << iota, 1 << iota - 1; // bit0 == 1, mask0 == 0
+ bit0, mask0 = 1 << iota, 1 << iota - 1; // bit0 == 1, mask0 == 0
bit1, mask1; // bit1 == 2, mask1 == 1
bit2, mask2; // bit2 == 4, mask2 == 3
)
@@ -1781,7 +1781,7 @@ Value = Expression .
The LiteralType must be a struct, array, slice, or map type
(the grammar enforces this constraint except when the type is given
as a TypeName).
-The types of the expressions must be assignment compatible to
+The types of the expressions must be assignment compatible 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,
@@ -2297,7 +2297,7 @@ f(a1, a2, ... an)
@@ -2455,7 +2455,7 @@ operators, comparison operators, communication operators,
f
with arguments a1, a2, ... an
.
The arguments must be single-valued expressions
-assignment compatible with the parameters of
+assignment compatible with the parameters of
F
and are evaluated before the function is called.
The type of the expression is the result type
of F
.
@@ -2389,7 +2389,7 @@ log_op = "||" | "&&" .
com_op = "<-" .
rel_op = "==" | "!=" | "<" | "<=" | ">" | ">=" .
add_op = "+" | "-" | "|" | "^" .
-mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" .
+mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" .
unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" .
Precedence Operator
- 6 * / % << >> & &^
+ 6 * / % << >> & &^
5 + - | ^
4 == != < <= > >=
3 <-
@@ -2475,7 +2475,7 @@ Examples:
+x
23 + 3*x[i]
x <= f()
-^a >> b
+^a >> b
f() || g()
x == y + 1 && <-chan_ptr > 0
@@ -2502,8 +2502,8 @@ to strings; all other arithmetic operators apply to integers only.
^ bitwise xor integers
&^ bit clear (and not) integers
-<< left shift integer << unsigned integer
->> right shift integer >> unsigned integer
+<< left shift integer << unsigned integer
+>> right shift integer >> unsigned integer
- x x / 4 x % 4 x >> 2 x & 3
+ x x / 4 x % 4 x >> 2 x & 3
11 2 3 2 3
-11 -2 -3 -3 1
@@ -2559,8 +2559,8 @@ integer and logical shifts if it is an unsigned integer. The shift count must
be an unsigned integer. There is no upper limit on the shift count. Shifts behave
as if the left operand is shifted n
times by 1 for a shift
count of n
.
-As a result, x << 1
is the same as x*2
-and x >> 1
is the same as
+As a result, x << 1
is the same as x*2
+and x >> 1
is the same as
x/2
truncated towards negative infinity.
-const Huge = 1 << 100; -const Four int8 = Huge >> 98; +const Huge = 1 << 100; +const Four int8 = Huge >> 98;
@@ -3122,7 +3122,7 @@ only once. The op=
construct is a single token.
-a[i] <<= 2 +a[i] <<= 2
@@ -3159,8 +3159,8 @@ a, b = b, a // exchange a and b
-In assignments, the type of each value must be assignment compatible -(§Assignment compatibility) with the type of the +In assignments, the type of each value must be +assignment compatible with the type of the operand to which it is assigned.
@@ -3402,7 +3402,7 @@ A "for" statement with a "for" clause is also controlled by its condition, but additionally it may specify an init and a post statement, such as an assignment, an increment or decrement statement. The init statement may be a -short variable declaration, but the post statement must not. +short variable declaration, but the post statement must not.@@ -3460,7 +3460,7 @@ map key, and the second variable, if present, is set to the corresponding string or array element or map value. The types of the array or slice index (alwaysint
) and element, or of the map key and value respectively, -must be assignment compatible to the iteration variables. +must be assignment compatible to the iteration variables.For strings, the "range" clause iterates over the Unicode code points @@ -3575,8 +3575,8 @@ in the "select" statement. If multiple cases can proceed, a uniform fair choice is made to decide which single communication will execute.
-The receive case may declare a new variable using a short variable declaration -(§Short variable declarations). +The receive case may declare a new variable using a +short variable declaration.
@@ -3633,7 +3633,7 @@ type:
- The return value or values may be explicitly listed in the "return" statement. Each expression must be single-valued - and assignment-compatible to the corresponding element of + and assignment compatible to the corresponding element of the result type of the function.
func simple_f() int {