this post was submitted on 16 Feb 2025
309 points (94.3% liked)
Technology
62936 readers
4239 users here now
This is a most excellent place for technology news and articles.
Our Rules
- Follow the lemmy.world rules.
- Only tech related content.
- Be excellent to each other!
- Mod approved content bots can post up to 10 articles per day.
- Threads asking for personal tech support may be deleted.
- Politics threads may be removed.
- No memes allowed as posts, OK to post as comments.
- Only approved bots from the list below, to ask if your bot can be added please contact us.
- Check for duplicates before posting, duplicates may be removed
- Accounts 7 days and younger will have their posts automatically removed.
Approved Bots
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I had the impression Rust doesn't handle concurrency particularly well, at least no better than Python, which does it badly (i.e. with colored functions). Golang, Erlang/Elixir, and GHC (Haskell) are way better in that regard, though they each have their own unrelated issues. I had believed for a while that Purescript targeting the Erlang VM and with all the JS tooling extirpated might be the answer, but that was just a pipe dream and I don't know if it was really workable.
Rust makes multi threading very easy you can just use
But rust makes Async difficult because it's naturally stackless so you need to create your own scheduler or use someone else's like Tokio. Also, people have a bad habit of conflating async with concurrency which makes it more confusing.
Sure you can spawn threads but now you have all the hazards of shared memory and locks, giving the 2.0 version of aliasing errors and use-after-free bugs. Also, those are POSIX threads, which are quite heavyweight compared to the in-process multitasking of Golang etc. So I would say that's not really an answer.
They are OS threads (so yes heavy).
But I think if you manage to use-after-free or other memory error in safe Rust it's a compiler bug. Or you used
unsafe
and have a soundness issue in the code you did.Note : as I understand it, unsafe is a way to tell the compiler you can check its safety guarantees yourself. But you may fail and get back other languages inexistent guarantees.