Skip to content

spec: remove unnecessary syntax restrictions for method expressions to match compiler #9060

@griesemer

Description

@griesemer
At the moment, method expressions must be of the form T.m or (*T).m . There's no good reason not to generalize the notation to T.m where T is any kind of type that has a method m. The
only options are the ones we already have, as well as unnamed interface types and struct
type embedding fields with methods.

These extra cases are largely academic but there's no real reason for the restriction;
it only adds complexity to the spec and requires extra checks in the compiler.

This would be a backward-compatible language change w/o impact to users. It would
simplify the spec. It simplifies the type-checker. It may simplify the rest of the
implementation.

See also issue #8605.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions