Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
spec: document interface satisfaction more explicitly #5570
IMO, the first three sentences at the link do define both exactly and completely (together -> clearly) the requirements: """ An interface type specifies a method set called its interface. A variable of interface type can store a value of any type with a method set that is any superset of the interface. Such a type is said to implement the interface. """
The section on method sets describes that the inclusion criteria is only related to methods, but doesn't say what it is exactly. The compilers use the rules for function identity for interface matching. You could probably refer to the type identity section, but extending it to methods or members of method sets might be confusing. Methods don't exist as types in the language, and methods and members of method sets have different identity rules. Example: method identity: func (f Foo) Bar(fb FooBar) == func (b Foo) Bar(bf FooBar) func (f Foo) Bar(fb FooBar) != func (b FooBar) Bar(bf Foo) member of method set identity: func (f Foo) Bar(fb FooBar) == func (b FooBar) Bar(bf FooBar)