diff --git a/doc/go_spec.html b/doc/go_spec.html index db149a9b531..5cd890ab932 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,9 +1,8 @@ - + @@ -1121,9 +1121,9 @@ KeyType = Type .
The comparison operators ==
and !=
-(§Comparison operators) must be fully defined for operands of the
-key type; thus the key type must be a boolean, numeric, string, pointer, function, interface,
-map, or channel type. If the key type is an interface type, these
+(§Comparison operators) must be fully defined
+for operands of the key type; thus the key type must not be a struct, array or slice.
+If the key type is an interface type, these
comparison operators must be defined for the dynamic key values;
failure will cause a run-time panic.
@@ -1374,58 +1374,6 @@ represents the zero value for that type.
Any value may be assigned to the blank identifier.
-Except as noted, values of any type may be compared to other values of -compatible static type. -Values of integer, floating-point, and string type may be compared using the -full range of comparison operators; -booleans and complex values may be compared only for equality or inequality. -
- -
-Values of composite type may be
-compared for equality or inequality using the ==
and
-!=
operators, with the following provisos:
-
nil
.
-A slice value is equal to nil
if it has been assigned the explicit
-value nil
, if it is uninitialized, or if it has
-been assigned another slice value equal to nil
·
-nil
if it has
-been assigned the explicit value nil
, if it is uninitialized,
-or if it has been assigned another interface value equal to nil
.
-nil
,
-two values of the same type are equal if they both equal nil
,
-unequal if one equals nil
and one does not.
-make
-(§Making slices, maps, and channels).
-When comparing two values of channel type, the channel value types
-must be identical but the channel direction is ignored.
-x < x + 1
is alw
-Comparison operators yield a value of type bool
.
-The operators ==
and !=
apply
-to operands of all types except arrays and structs.
-All other comparison operators apply only to integer, floating-point
-and string values.
+Comparison operators compare two operands and yield a value of type bool
.
@@ -2977,20 +2921,71 @@ and string values.
-Operands of numeric type are compared in the usual way. -
+The operands must be comparable; that is, the first operand +must be assignment compatible +with the type of the second operand, or vice versa.-Operands of string type are compared byte-wise (lexically).
-
-Operands of boolean type are equal if they are either both true
-or both false
.
-
-The rules for comparison of composite types are described in the
-section on §Comparison compatibility.
+The operators ==
and !=
apply
+to operands of all types except arrays and structs.
+All other comparison operators apply only to integer, floating-point
+and string values. The result of a comparison is defined as follows:
u
, v
are
+ equal if both real(u) == real(v)
and
+ imag(u) == imag(v)
.
+ true
or both false
.
+ nil
.
+ nil
.
+ nil
.
+ make
+ (§Making slices, maps, and channels)
+ or if both are nil
.
+ nil
.
+ x
is equal to a non-interface value
+ y
if the dynamic type of x
is identical to
+ the static type of y
and the dynamic value of x
+ is equal to y
.
+ nil
if it has been assigned the explicit value
+ nil
, if it is uninitialized, or if it has been assigned
+ another value equal to nil
.
+