News for hackers. Stuff that matters.
Re:Pessimism about parallelism by Groxx on Wednesday December 26, 2018 @09:50PM (#18766862)
>Any useful definition of thread safety requires that you can reason about program behavior in the presence of concurrency.

Theoretically yeah, but there's a lot of practical gain to be had even with that example. Other languages won't tell you if you forgot to use the mutex somewhere.

Re:Pessimism about parallelism by rbehrends on Thursday December 27, 2018 @08:51AM (#18769414)
Okay.

First, I was talking about useful definitions of thread safety. That was language-agnostic, not related to Rust. And if absence of data races were all that Rust guaranteed, then Rust indeed wouldn't be much of a help. What Rust actually does is require you to be (fairly) explicit about threads interacting with each other, which is a much stronger type of guarantee [1]. Rust comes with a default setting derived from the general shared-xor-mutable principle that threads don't mess with each other's data without permission, which makes it easier to reason about thread interaction.

Second, the OP was comparing Rust to actor languages. Actor languages also don't have data races and don't require mutexes (because the memory spaces of actors are disjoint and actors themselves are sequential). In fact, actor languages provide even stronger guarantees, as actors can only interact with each other at well-defined points. "Fearless concurrency" hails back to the 1970s. It is not a new invention, nor is it unique to Rust. It is great that Rust supports it, but I really wish people would stop talking about it being novel and unique.

[1] Which is not to say that Rust's choices don't come with tradeoffs, but then, in the area of concurrency, you cannot realistically avoid tradeoffs. In Rust's case, as with actors, the primary tradeoff is performance for safety.

Re:Pessimism about parallelism by sedachv on Tuesday January 01, 2019 @06:34PM (#18803101)
> It is great that Rust supports it, but I really wish people would stop talking about it being novel and unique.

What I really wish people would learn from Actors is that even if your programming language prevents trivial race conditions over shared memory or message passing primitives, none of that guarantees anything about the behavior of the system you are building once you start to compose those primitives. Gul Agha's dissertation was really eye-opening.

Re:Pessimism about parallelism by fooker on Thursday December 27, 2018 @03:39AM (#18768317)
> Other languages won't tell you if you forgot to use the mutex somewhere.

Languages like C++ and D treat this as a library design challenge, not a core language feature. Look at std::lock_guard, for example.

Re:Pessimism about parallelism by pornel on Thursday December 27, 2018 @06:20AM (#18768861)
The Rust language doesn't know anything about locking, or even threads.

The thread safety is built using Send/Sync traits, which libraries for threading and synchronization primitives, atomics, etc. implement accordingly.