Skip to content

mutate struct field using the struct reference - #679

Closed
kapad wants to merge 1 commit into
mmcgrana:masterfrom
kapad:master
Closed

kapad wants to merge 1 commit into
mmcgrana:masterfrom
kapad:master

Conversation

@kapad

@kapad kapad commented Sep 5, 2026

Copy link
Copy Markdown

it may be unclear whether struct or struct pointers are mutable.

mutation via the struct reference and then printing via the pointer will add clarity.

it may be unclear whether struct or struct pointers are mutable.

mutation via the struct reference and then printing via the pointer will add clarity.
fmt.Println(sp.age)

// Structs are mutable.
sp.age = 51

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe move the mutable part before the pointer part.

  1. Show structs are mutable with s
  2. Then in the "pointers" section, show both access and mutation one after another, through sp

@kapad

kapad commented Sep 7, 2026 via email

Copy link
Copy Markdown
Author

@eliben eliben closed this Sep 7, 2026
eliben added a commit that referenced this pull request Sep 7, 2026
Based on initial suggestion in #679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants