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.

-

Comparison compatibility

- -

-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: -

-

Blocks

@@ -2960,11 +2908,7 @@ not occur. For instance, it may not assume that x < x + 1 is alw

Comparison operators

-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:

+ +

Logical operators