r/ProgrammerHumor • • Sep 13 '23

Meme goDevelopersWillAppreciateIt

Post image
2.4k Upvotes

144 comments sorted by

View all comments

Show parent comment

-10

u/parthvsquare Sep 13 '23 edited Sep 13 '23

Multi threading in rust is a nightmare

Before everyone downvote me Edit: i meant to say is, understanding threads and passing data between them is quite hard for new comer. There is also macros, which i would gladly stay away.

(I might be dumb that’s why i found it hard to graps)

47

u/sypwn Sep 13 '23

Debugging multi threading in every other language is a worse nightmare.

11

u/Sekret_One Sep 13 '23

Go channels are pretty cool.

14

u/Kenkron Sep 13 '23
fn question<T: Send+Sync> (q: Arc<RWLock<T>>) {
    println!("What do you mean {}?", q);
}

9

u/javajunkie314 Sep 13 '23

Multithreading? Rust has great support for multithreading, and will even help you avoid data races.

Do you mean asynchronous code? (A.k.a. async-await?) That's definitely newer and a bit trickier—it's also an area of focus for the Rust developers and improving. But yeah, some sharp edges there.

The advice I've seen is to stick with synchronous (single thread or threaded) Rust while you're learning, until you need a level of concurrency that OS threads can't support. (Or need to target an embedded system without OS threads.) I think I agree with that, and you can do a lot with good ol' threads. Most people aren't writing the next high-performance HTTP server.

3

u/Angelin01 Sep 13 '23

Quite the opposite! I did a full duplex websocket based program, that's a multithreaded nightmare! The compiler/general language design stopped me from foot gunning myself more times than I can count, I learn to appreciate it a lot more after that.