Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "More to Explore" section to struct patterns slide #2604

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

randomPoison
Copy link
Collaborator

Talking about matching on references and interactions with constants are useful to note but not super important imo. Breaking those notes into the "More to Explore" section would at least help me remember to only go into that if students ask or there's enough extra time to cover them.

@djmitche djmitche self-requested a review January 31, 2025 17:34
Copy link
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

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

I agree about the constants, but it seems like match ergonomics is a subtle syntactic thing that can be confusing if you're not aware of it:

match ref_to_a_foo {
  Foo(x) => ..
}

it's not at all obvious that x is a reference in this context.

@randomPoison
Copy link
Collaborator Author

I agree match ergonomics is a bit subtle and could definitely be a point of confusion for new programmers, but I think it's also easier to understand once you better understand ownership and references. I find explaining it here to be distracting from the more core point about how patterns work, since that's the main thing students are trying to grok at this point.

@djmitche
Copy link
Collaborator

djmitche commented Feb 5, 2025

Good point!

@randomPoison randomPoison merged commit 28ab749 into main Feb 6, 2025
37 checks passed
@randomPoison randomPoison deleted the legare/struct-pattern-notes branch February 6, 2025 00:12
michael-kerscher pushed a commit to michael-kerscher/comprehensive-rust that referenced this pull request Feb 7, 2025
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