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

Remove slide on shadowing #2596

Merged
merged 2 commits into from
Feb 6, 2025
Merged

Remove slide on shadowing #2596

merged 2 commits into from
Feb 6, 2025

Conversation

randomPoison
Copy link
Collaborator

I don't think we need to cover shadowing. I wouldn't say it's an advanced concept, but I think it's somewhat niche. It's a useful thing to know about the language, but it's also used fairly infrequently (in my experience). I think it just takes too long to explain for how rarely it is used, since I also have to explain why it's useful (students tend to assume this is an anti-pattern). I don't think we lose much by dropping this, and I think the time we gain back is more valuable.

The shadowing slide was technically the first place we talk about scoping in Rust, so I've moved that to the previous slide on blocks. I think it fits there a bit more naturally. We do briefly cover the topic in the slide on ownership, but I think it's also good to mention it earlier.

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 do see shadowing quite frequently IRL, and in fact it's such a habit I often try to do it in C++! But I agree that this is a good bit to trim.

Which was, confusingly, already named "Blocks and Scopes".
@randomPoison randomPoison force-pushed the legare/remove-shadowing branch from 496c421 to 3673125 Compare February 6, 2025 20:27
@randomPoison
Copy link
Collaborator Author

Yeah that's fair, it's not that rare, but it's unwieldly to explain in my experience, and not terribly important in my opinion. I figure students can grok it when they see it happening in the wild.

@randomPoison randomPoison merged commit f1459c5 into main Feb 6, 2025
37 checks passed
@randomPoison randomPoison deleted the legare/remove-shadowing branch February 6, 2025 20:39
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