Hacker News new | ask | show | jobs
by rationalthug 4081 days ago
On a somewhat interesting note: transferable objects work similarly in web workers. There have been complaints, of course, that this makes it impossible to take advantage of shared memory in cases where it provides clear performance benefits.
1 comments

Wouldn't the concept of borrowing avoid that issue in Rust though?
Actually, atomics and locks (which are fully supported) are what avoid that issue in Rust. You can't borrow across multiple threads.
You can now with scoped threads, provided that you don't require mutation.
Actually, it's possible to share a &mut into a scoped threat too, and perform mutation through it. It's safe because the &mut only ever exists in one place at a time.