Skip to content

spec: Interface method specifiers #10291

@nhooyr

Description

@nhooyr

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions