From 0e08b02ac54c9232759704812f41a5836f920cff Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Tue, 15 Mar 2022 10:15:53 -0700 Subject: [PATCH] spec: clarify rules for type set construction of an interface Be explicit that we always mean non-interface types when we talk about sets of types. Also, clarify that the quantification "all non-interface types" means all such types in all possible programs, not just the current program. Per suggestion from Philip Wadler. Change-Id: Ibc7b5823164e547bfcee85d4e523e58c7c27ac8a Reviewed-on: https://go-review.googlesource.com/c/go/+/398655 Reviewed-by: Ian Lance Taylor Reviewed-by: Robert Griesemer Reviewed-by: Ian Lance Taylor Reviewed-by: Robert Griesemer --- doc/go_spec.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index b496e9e48f..b272cb5df6 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -1278,7 +1278,8 @@ then the File interface is implemented by both S1 and

Every type that is a member of the type set of an interface implements that interface. Any given type may implement several distinct interfaces. -For instance, all types implement the empty interface which stands for the set of all types: +For instance, all types implement the empty interface which stands for the set +of all (non-interface) types:

@@ -1380,7 +1381,7 @@ definition of an interface's type set as follows:
 		of its interface elements.
 	
 
-	
  • The type set of a method specification is the set of types +
  • The type set of a method specification is the set of all non-interface types whose method sets include that method.
  • @@ -1389,7 +1390,7 @@ definition of an interface's type set as follows:
  • The type set of a term of the form ~T - is the set of types whose underlying type is T. + is the set of all types whose underlying type is T.
  • The type set of a union of terms @@ -1398,6 +1399,15 @@ definition of an interface's type set as follows:
  • +

    +The quantification "the set of all non-interface types" refers not just to all (non-interface) +types declared in the program at hand, but all possible types in all possible programs, and +hence is infinite. +Similarly, given the set of all non-interface types that implement a particular method, the +intersection of the method sets of those types will contain exactly that method, even if all +types in the program at hand always pair that method with another method. +

    +

    By construction, an interface's type set never contains an interface type.

    -- 2.50.0