[rust-dev] Why focus on single-consumer message passing?

Patrick Walton pcwalton at mozilla.com
Sun Jan 26 11:51:00 PST 2014


On 1/26/14 7:00 AM, Vladimir Lushnikov wrote:
> Here are a couple of observations/comments from a rust lurker:
>
> * +1 for message-passing as a core paradigm for inter-thread
> communication. It is significantly easier to reason about than shared
> memory. It is not a silver bullet for all cases of course (but that is
> why you have unsafe code):

Well, you don't need unsafe code for shared memory. IMHO, one of the 
best features about Rust is that it has an excellent story for shared 
memory when you need it: it's memory safe and race free.

But in the general case, "do not communicate by sharing memory; share 
memory by communicating" should still be your first approach. There is 
nothing evil about shared memory, but I think history has shown that it 
is inherently harder to reason about.

Patrick



More information about the Rust-dev mailing list