-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
The spec says this: https://golang.org/ref/spec#MethodSpec
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 value of an uninitialized variable of interface type is nil.
InterfaceType = "interface" "{" { MethodSpec ";" } "}" .
MethodSpec = MethodName Signature | InterfaceTypeName .
MethodName = identifier .
InterfaceTypeName = TypeName .
Shouldn't the MethodSpec be equal to (MethodName Signature) | InterfaceTypeName?
Because that implies that you can have a MethodName next to a InterfaceTypeName and it will be valid? But having the parentheses means that those are grouped together, thus you either get InterfaceTypeName or MethodName + Signature.