Skip to content

spec: direct reference to embedded fields in struct literals #9859

Description

@adg

(Status: referred from LanguageChange to Proposal. --adonovan)

Consider

type E struct {
    A int
}

type T struct {
    E
}

This works:

T{E: E{A: 1}}

This does not:

T{A: 1}

Makes some struct literals more verbose than they need be, and makes them asymmetrical to their usage (where you can access the embedded struct's fields directly).

Can we allow it?

(cc @bradfitz)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

  • Status
    Accepted

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions