diff --git a/doc/go_spec.html b/doc/go_spec.html index 6d7f90e98d..7b4bde0fe0 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -2684,18 +2684,17 @@ other interfaces based on their type sets. But this should get us going for now. The predeclared interface type comparable denotes the set of all non-interface types that are -comparable. Specifically, +strictly comparable. Specifically, a type T implements comparable if:

@@ -2707,12 +2706,13 @@ Even though interfaces that are not type parameters can be

-int                          // implements comparable
+int                          // implements comparable (int is strictly comparable)
 []byte                       // does not implement comparable (slices cannot be compared)
 interface{}                  // does not implement comparable (see above)
-interface{ ~int | ~string }  // type parameter only: implements comparable
-interface{ comparable }      // type parameter only: implements comparable
-interface{ ~int | ~[]byte }  // type parameter only: does not implement comparable (not all types in the type set are comparable)
+interface{ ~int | ~string }  // type parameter only: implements comparable (int, string types are stricly comparable)
+interface{ comparable }      // type parameter only: implements comparable (comparable implements itself)
+interface{ ~int | ~[]byte }  // type parameter only: does not implement comparable (slices are not comparable)
+interface{ ~struct{ any } }  // type parameter only: does not implement comparable (field any is not strictly comparable)
 

@@ -5019,69 +5019,71 @@ to the type of the second operand, or vice versa.

The equality operators == and != apply -to operands that are comparable. +to operands of comparable types. The ordering operators <, <=, >, and >= -apply to operands that are ordered. +apply to operands of ordered types. These terms and the result of the comparisons are defined as follows:

A comparison of two interface values with identical dynamic types -causes a run-time panic if values -of that type are not comparable. This behavior applies not only to direct interface +causes a run-time panic if that type +is not comparable. This behavior applies not only to direct interface value comparisons but also when comparing arrays of interface values or structs with interface-valued fields.

-Slice, map, and function values are not comparable. +Slice, map, and function types are not comparable. However, as a special case, a slice, map, or function value may be compared to the predeclared identifier nil. Comparison of pointer, channel, and interface values to nil @@ -5126,6 +5132,30 @@ var ( ) +

+A type is strictly comparable if it is comparable and not an interface +type nor composed of interface types. +Specifically: +

+ + +

Logical operators