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

feat: add functions6.rs and move_semantics6.rs exercises about closures #1748

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rikettsie
Copy link

This PR contains a couple of exercises about closures, one in the 02_functions group, the other in the 06_move_semantics. Hints and documentation references are added to correctly complete the exercises.

@chrestomanci
Copy link

I am a student learning Rust, and while I support adding exercises about closures to Rustlings, I think it would be unfair and needlessly difficult for students to add those exercises to the 02_functions and 06_move_semantics section of Rustlings, because closures are considered a more advanced feature of Rust, and they are not described till later in the Rust book.

A student who is a beginner with learning rust, and is following along the Rust book would find these exercises too hard for their level of learning, and would not be able to skip them easily.

Issue #1937 relates to how the order of some exercises is slightly different from the book, but for that issue it would be fairly easy for the student to read ahead and solve the problems. For these exercises you propose, I don't think a student could realistically read ahead because there are a great many concepts that would need to be understood to get that far into the book.

Could you create another section for these and other advanced exercises ?

@mo8it mo8it mentioned this pull request Sep 2, 2024
@rikettsie rikettsie force-pushed the feat/add-closure-exercises branch from 5f2aff6 to 7274f1d Compare September 29, 2024 18:42
@rikettsie rikettsie changed the title feat: add functions6.rs and move_semantics7.rs exercises about closures feat: add functions6.rs and move_semantics6.rs exercises about closures Sep 29, 2024
@rikettsie rikettsie force-pushed the feat/add-closure-exercises branch 2 times, most recently from 9068bfb to d83ee30 Compare September 29, 2024 18:53
@rikettsie rikettsie force-pushed the feat/add-closure-exercises branch from d83ee30 to e59c65c Compare September 29, 2024 18:58
@rikettsie
Copy link
Author

@chrestomanci, your point makes sense, but as you say your perspective comes from your personal learning experience, and I think we should always be careful when reasoning about what is a good learning path, as there's no standard one.

Very often, gently introducing harder concepts earlier, allows one to better take them on later for deeper understanding.

In this case, because rust heavily supports functional patterns, you may argue that it's not too early to bring the student a taste of those special functions, namely closures, suggesting how they behave differently (e.g. in "passing" in parameters) right after studying function usage.

The idea here is this is only an introduction suggesting for more room later, i.e. a dedicated chapter probably before iterators and mappers, as these components leverage functional rust with the full expressivity of closures.

A discussion about such a dedicated chapter is going on with the PR #1746 if you want to join.

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