From: Robert Griesemer
In its most basic form an interface specifies a (possibly empty) list of methods. The type set defined by such an interface is the set of types which implement all of those methods, and the corresponding method set consists exactly of the methods specified by the interface. +Interfaces whose type sets can be defined entirely by a list of methods are called +basic interfaces.
@@ -1315,6 +1319,8 @@ they implement the+Lockerinterface as well as theFileinterface. +Embedded interfaces
+In a slightly more general form an interface
Tmay use a (possibly qualified) interface type @@ -1359,8 +1365,10 @@ type ReadCloser interface { }
-Finally, in their most general form, an interface element may also be an arbitrary type term
+In their most general form, an interface element may also be an arbitrary type term
T, or a term of the form ~T specifying the underlying type T,
or a union of terms t1|t2|â¦|tn.
Together with method specifications, these elements enable the precise
@@ -1462,21 +1470,21 @@ interface {
Implementation restriction:
-A union with more than one term cannot contain interface types
-with non-empty method sets or which
-are or embed the predeclared identifier
-comparable.
+A union with more than one term cannot contain the
+predeclared identifier comparable
+or interfaces that specify methods, or embed comparable or interfaces
+that specify methods.
-Interfaces that contain non-interface types, terms of the form ~T,
-or unions may only be used as type constraints, or as elements of other interfaces used
-as constraints. They cannot be the types of values or variables, or components of other,
+Interfaces that are not basic may only be used as type
+constraints, or as elements of other interfaces used as constraints.
+They cannot be the types of values or variables, or components of other,
non-interface types.
-var x Floats // illegal: Floats is restricted by float32 and float64
+var x Floats // illegal: Floats is not a basic interface
var x interface{} = Floats(nil) // illegal
@@ -1714,7 +1722,7 @@ The underlying type of P is interface{}.
Core types
-Each non-interface type T has a core type, which is the
+Each non-interface type T has a core type, which is the same as the
underlying type of T.
@@ -2665,9 +2673,9 @@ TypeConstraint = TypeElem .
-If the constraint is an interface literal containing exactly one embedded type element
-interface{E}, in a type parameter list the enclosing interface{ ⦠}
-may be omitted for convenience:
+If the constraint is an interface literal of the form interface{E} where
+E is an embedded type element (not a method), in a type parameter list
+the enclosing interface{ ⦠} may be omitted for convenience: