From: Robert Griesemer
...
or ... T
to indicate that the function
may be invoked with zero or more additional arguments. If the type
T
is present in the parameter declaration, the additional
-arguments must all be
-assignment compatible
-with type T
; otherwise they may be of any type.
+arguments must all be assignable
+to T
; otherwise they may be of any type.
@@ -1322,11 +1321,11 @@ is different from[]string
. -Assignment compatibility
+Assignability
-A value
x
is assignment compatible with typeT
-(x
can be assigned toT
) in any of these cases: +A valuex
is assignable to a variable of typeT
+("x
is assignable toT
") in any of these cases:
If the type is present, all constants take the type specified, and
-the expressions must be assignment compatible with that type.
+the expressions must be assignable to that type.
If the type is omitted, the constants take the
individual types of the corresponding expressions.
If the expression values are untyped constants,
@@ -1993,8 +1992,8 @@ 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 with
-the respective field, element, and key types of the LiteralType;
+The types of the expressions must be assignable
+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.
@@ -2375,8 +2374,8 @@ where M
is a map type:
x
's type must be
- assignment compatible
- with the key type of M
M
x
,
a[x]
is the map value with key x
and the type of a[x]
is the value type of M
calls f
with arguments a1, a2, ... an
.
Except for one special case, arguments must be single-valued expressions
-assignment compatible with the parameter types of
+assignable to the parameter types of
F
and are evaluated before the function is called.
The type of the expression is the result type
of F
.
@@ -2557,8 +2556,8 @@ pt.Scale(3.5) // method call with receiver pt
As a special case, if the return parameters of a function or method
-g
are equal in number and individually assignment
-compatible with the parameters of another function or method
+g
are equal in number and individually
+assignable to the parameters of another function or method
f
, then the call f(g(parameters_of_g))
will invoke f
after binding the return values of
g
to the parameters of f
in order. The call
@@ -2702,8 +2701,8 @@ For operations involving constants only, see the section on
In a channel send, the first operand is always a channel and the second -must be a value assignment compatible -with the channel's element type. +must be a value assignable +to the channel's element type.
@@ -2915,8 +2914,8 @@ Comparison operators compare two operands and yield a value of type
The operands must be comparable; that is, the first operand
-must be assignment compatible
-with the type of the second operand, or vice versa.
+must be assignable
+to the type of the second operand, or vice versa.
The operators
In assignments, each value must be
-assignment compatible with the type of the
+assignable to the type of the
operand to which it is assigned. If an untyped constant
is assigned to a variable of interface type, the constant is converted
to type bool
==
and !=
apply
@@ -3258,7 +3257,7 @@ of these cases:
x
can be assigned
+ x
is assignable
to T
.
bool
, int
, float
,
@@ -3989,7 +3988,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 (always int
)
and element, or of the map key and value respectively,
-must be assignment compatible with
+must be assignable to
the type of the iteration variables. The expression on the right hand
side is evaluated once before beginning the loop. At each iteration
of the loop, the values produced by the range clause are assigned to
@@ -4033,7 +4032,7 @@ for i, s := range a {
}
var key string
-var val interface {} // value type of m is assignment compatible with val
+var val interface {} // value type of m is assignable to val
for key, val = range m {
h(key, val)
}
@@ -4165,9 +4164,8 @@ type:
func simple_f() int {
return 2
@@ -4494,7 +4492,7 @@ The built-in function
copy
copies slice elements from
a source src
to a destination dst
and returns the
number of elements copied. Source and destination may overlap.
Both arguments must have identical element type T
and must be
-assignment compatible to a slice
+assignable to a slice
of type []T
. The number of arguments copied is the minimum of
len(src)
and len(dst)
.