-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
arc1 seems like a giant step #250
Comments
Hi @chrisridd, I agree that Thank you, Abdou |
Hi @AbdouSeck, the problem at the moment is the threads exercises come after |
Awesome! Go for it! |
Just an FYI, a previous issue (#205) suggested the opposite and this commit fbe91a6 was made. But I agree with what @chrisridd. It was a big leap. I think it might be helpful for the README under |
I agree! |
Im stuck at Arc1. Threads exercise never showed up.. how to `go for it :) in-case anyone is stuck like me please read : https://medium.com/@DylanKerler1/how-arc-works-in-rust-b06192acd0a6
|
I too had problems with Arc1. It seems very strange to me that you
Why couldn't you just do all those three steps once on each iteration? I think I did what I was suppose to, but I have no idea why. So, not a great learning experience. :P |
+1, can we maybe have some tests to figure out what the output should be. I can't figure out what this exercice wants me to do. |
I agree that this exercise is completely out of place. Consider that the next (iterator) exercise basically asks you to figure out which string comes after "banana" in the list. Presumably most people can just read the hint and bang on the keyboard until it works like I did. But I don't feel Iearned anything. Also: atomic reference counting seems to be something specific to Rust and (in my limited experience) in C++ where it's a rather esoteric concept. Is Arc really so commonly used that this should be the second exercise in |
+1 but I'm also an idiot. |
I came to open an issue on Should this be moved for later? Maybe threads and closures can be explained first? Whatever, back to reading whole Chapter 16 as sl4m suggests. |
I second @doup |
I see a bit of a dilemma in that the "learners" agreeing that this material is too advanced in this position don't feel qualified to judge where this should be moved too and the authors of the advanced material have moved on/don't agree/don't care. This issue has been around for ages. Does anyone subscribing to this issue know if there is a project lead that could be pinged or is rustlings just a free-for-all? |
@a2800276 This issue has been around for ages, correct, and I agree that something should be done about it. However, there's a couple of things to note about this exercise and this project (which should hopefully answer your question):
For
None of these are very likely to happen (although maybe now with the Rust Foundation it might be easier to get some funding for keeping this project up to date), which is why this issue and some others are in the state they're in. Hope this helps! |
@fmoko Of course I realize that the maintainers are volunteers. My whole point was the paradox that by the nature of this project, the actual users are not qualified to provide fixes. This is especially worrisome considering rustlings is the 2nd popular rust repo paired with your statement that the course needs a makeover to reflect contemporary usage. Maybe at least a warning could be added to the repo, the learners using it can't be expected to judge the relevance of exercises, because rustlings is likely their first contact with the language. I can only speak for myself, but this exercise made me give up rustlings and focus on learning by book. |
Hm, I understand your concern, but I'm not sure whether doing something as drastic as that is useful to the project and the state of learning Rust. I wouldn't say that rustlings is not relevant to the language in its current state, the "core" features (which is most of what we're teaching here) basically don't change at all. It's really only exercises like this that document fairly advanced features of the language/standard library that can become outdated and in need of a refactor.
An aside, I don't think that "users are not qualified to provide fixes" at all. There have been plenty of good ideas and starting points in this issue and others, but this goes back to my previous comment: Someone needs to take the initiative. Sometimes this happens, sometimes this doesn't, that's how open source works. |
Greetings, I created a pull request (#710) that will hopefully alleviate this issue and perhaps close it. I read through the issue and though I'm new to rust, it seemed an opportunity to contribute. Rustlings is an amazing little tool. :-). I was also struck by @fmoko's comments that they would "probably remove [these advanced concepts]" which makes me sad because I think there's a place for more advanced concepts in this wonderful project. I was also struck by @fmoko's disagreement that "users are not qualified to provide fixes" and took it as a personal challenge. I've never contributed to a Github in any substantial (or semi-substantial) manner and thought "hey, maybe I can learn something and help out too. " So I read Chapter 16 (per this issue's thread), figured out what the point of this question is, and tried to color the intro comments to make it more clear to others too. The only actual code change I made was adding Hopefully my pull request is helpful to the community. |
fn main() {
let numbers: Vec<_> = (0..100u32).collect();
let shared_numbers = Arc::new(numbers); // TODO
let mut joinhandles = Vec::new();
for offset in 0..8 {
let child_numbers = Arc::clone(&shared_numbers); // TODO
joinhandles.push(thread::spawn(move || {
let sum: u32 = child_numbers.iter().filter(|n| *n % 8 == offset).sum();
println!("Sum of offset {} is {}", offset, sum);
}));
}
for handle in joinhandles.into_iter() {
handle.join().unwrap();
}
} I'm new to using Arc, I have followed the documentation, but it's still vague for me |
There are several new concepts in the
arc1.rs
exercise, and I wonder if it would be useful to have a few gentle lead ins before this exercise.In particular threads are a big leap in complexity with some new syntax (closures).
It would also be helpful to know what the arc1 code is trying to do in the first place. Reverse engineering the logic (with known missing lines of code) and figuring out threads and figuring out Arc, seems like too much for one exercise.
The text was updated successfully, but these errors were encountered: