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

variables5 is confusing #1713

Open
shadows-withal opened this issue Oct 11, 2023 · 3 comments
Open

variables5 is confusing #1713

shadows-withal opened this issue Oct 11, 2023 · 3 comments
Labels
A-exercises Area: Exercises C-enhancement Category: Enhancement P-medium Priority: Medium

Comments

@shadows-withal
Copy link
Member

It teaches about shadowing, which is not really useful if used like this (nor is it appropriate at this point in the curriculum).

@alex-ter
Copy link

At the very least I'd suggest elaborating on what's expected. Of course the hint has it, but for those who don't want to go for hints 🙂 it would be helpful to clarify that what the exercise wants is to preserve the println! lines as-is too, i.e., to have that number + 2 piece intact.

@mo8it
Copy link
Contributor

mo8it commented Jun 14, 2024

Related thread on Mastodon: https://indieweb.social/@mandarvaze/112612843843263157


@[email protected] :
variables5 seems like cheating
I understand the concept of shadowing, but this example seems forced.
No, I didn't think of the solution at first and needed hint (and then felt like I was cheated)


@[email protected]:
Well, looking at it, it gets the idea across of shadowing, it's just a not-immediately-visibly-evident way of teaching it to what I would consider good teaching technique
The compiler also isn't quite lending much help, that actually may be considered a bug!

@mo8it mo8it added C-enhancement Category: Enhancement A-exercises Area: Exercises P-medium Priority: Medium labels Sep 2, 2024
@dlloyd1
Copy link

dlloyd1 commented Nov 7, 2024

Hi,

First of all thanks for all the time and effort that's gone into rustlings, I'm finding it an excellent learning tool alongside the Rust book.

This is the first exercise that I found jarring whilst working through them.
The spelling of a number in a string felt like a distraction, for me.

For this issue, could the use of an inner and outer scope with {} help illuminate that we're looking for name shadowing specifically in this exercise? Without having to resort to the hint, I mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-exercises Area: Exercises C-enhancement Category: Enhancement P-medium Priority: Medium
Projects
None yet
Development

No branches or pull requests

4 participants