News for hackers. Stuff that matters.
Re:Why Rust? [pdf] by kibwen on Wednesday September 09, 2015 @04:59PM (#10194547)

  > I think it's a fair characterization given 1.0 shipped 
  > without them, and there doesn't seem to any timeline for 
  > standardization (please correct me if I'm wrong).
The release of 1.0 was not an indication that the language was 100% complete, or that the stdlib was 100% comprehensive. The 1.0 release represented a stable foundation upon which to build an ecosystem. Going forward, the Rust developers absolutely do care about providing more concurrency primitives. Here's Aaron Turon's recent work on implementing epoch-based memory reclamation for implementing lock-free data structures: http://aturon.github.io/blog/2015/08/27/epoch/ . Of the two interns the Rust project was granted this summer, one of them spent the entirety of their time working on supporting SIMD in the language (http://huonw.github.io/blog/2015/08/simd-in-rust/) while the other spent their time specifying the behaviors that are allowed inside Rust's `unsafe` blocks, which includes taking a good long stare at Rust's memory model and all its concurrency primitives and making sure that they're sound. While we're on the topic of interns, you're also overlooking the `Arc` pointer in the stdlib, which is an intern project from more than three years ago which allows one to safely share memory between threads. Meanwhile, pcwalton (Rust core team member and full-time Servo developer) has been working on shmem support and multiprocess allocators for Servo. In addition, the Rust stdlib contained an implementation of fork/join prior to 1.0, but at the last minute the API was found unsound for a few edge cases and so it was deprecated and a working implementation was deferred until later (today there are at least two working reimplementations of this on crates.io with the unsoundness fixed).

  > This apparently doesn't include preventing deadlocks, a 
  > problem that is common, hard-to-avoid, and difficult to 
  > recover from. Does that not strike you as a bit of an 
  > overreach?
Not at all. Statically preventing data races is an enormous leap forward in the state of the art. Here's a quote from Matthias Felleisen of Northeastern University on teaching Rust to students without experience in concurrent programming: https://www.youtube.com/watch?v=JBmIQIZPaHY&feature=youtu.be...

"I had them program parallel programs in Rust, and as some of you know, Rust prevents race conditions with its type checking. [Note that he's incorrect here, Rust prevents data races, not race conditions in general.] I will admit, the first two weeks, because we used the beta release, was a mess. We couldn't understand the type error messages. But once we got over the hump, I was blown away, that these kids never had problems writing parallel programs in imperative style. There were no race conditions. The type system slapped their fingers. We taught them how to design, the type system enforced it, and lo and behold, I hate to admit this but I have to admit it, they just didn't have problems with this stuff."

Re:Why Rust? [pdf] by acconsta on Wednesday September 09, 2015 @06:25PM (#10195067)
SIMD, lock free data structures, and ARC pointers are great. But what's the timeline for concurrent IO (either async or coroutines)? Preferably one that is stable, portable, and efficient (mio isn't the first two).

>Statically preventing data races is an enormous leap forward in the state of the art

The borrow checker is a great achievement. But it doesn't prevent deadlocks. And because Rust doesn't provide higher level concurrency tools than threads and mutexes, deadlocks are going to be a significant problem in practice until such tools are standardized.

Re:Why Rust? [pdf] by burntsushi on Wednesday September 09, 2015 @06:35PM (#10195113)
> But it doesn't prevent deadlocks.

Could you describe how you've developed the misconception that Rust does prevent deadlocks? Whatever it is, we should try to fix it right away, because Rust has never tried to prevent deadlocks, and suggesting that it does is not good.

> And because Rust doesn't provide higher level concurrency tools than threads and mutexes

Rust's standard library has channels.

Re:Why Rust? [pdf] by acconsta on Wednesday September 09, 2015 @07:17PM (#10195296)
This is all a response to:

https://news.ycombinator.com/item?id=10192042

Reasonable people can disagree about what "safe" and "easy" mean, but I don't think Rust's concurrency primitives are either given the (very real, very bad) possibility of deadlock.

>Rust's standard library has channels.

Which are a good start, but only a partial solution without coroutines (and the other additions you mentioned).

Re:Why Rust? [pdf] by burntsushi on Wednesday September 09, 2015 @07:31PM (#10195344)
> but I don't think Rust's concurrency primitives are either given the (very real, very bad) possibility of deadlock.

OK. Then I don't know what to say. An infinite loop is a deadlock. Unless you have a programming language that can guarantee termination, you can't prevent deadlocks statically.

So yes, I think a brief marketing pitch of "safe and easy concurrency" is totally appropriate given the domain Rust is shooting for. In fact, it is one of Rust's strengths, so to not advertise it as such would be quite odd.

> Which are a good start, but only a partial solution without coroutines (and the other additions you mentioned).

OK. But you said "And because Rust doesn't provide higher level concurrency tools than threads and mutexes" which just isn't true. I'm trying to clear up what it is Rust does have. I'm not saying it has everything. Writing software takes time.

Re:Why Rust? [pdf] by acconsta on Wednesday September 09, 2015 @08:35PM (#10195543)
>An infinite loop is a deadlock

It isn't. I don't know what else to say:

https://en.wikipedia.org/wiki/Deadlock