3 ms·
> I think you overestimate how willing most developers are to fight with the borrow checker instead of using actor libraries or task libraries (TPL, TBB, PPL,
by pcwalton 11y ago
> I think you overestimate how willing most developers are to fight with the borrow checker instead of using actor libraries or task libraries (TPL, TBB, PPL, Fork-Join, Akka) instead.
That seems like a non-sequitur. What does the borrow checker have to do with actor libraries?
Are you implying that these actor libraries give you the data race freedom guarantees that Rust's mutability rules give you? If so, that's trivially false. Those libraries guide you toward patterns that eliminate data races in simple cases if you follow them, but nothing enforces the rules. Moreover, being forced into actors or message passing for concurrency severely restricts the expressiveness of your program. Rust's approach lets you use shared memory if you like, or message passing if you like, or a combination of the two, with enforcement of the rules no matter which you pick.
> So far the Rust tricks with unsafe for certain data structures (e.g. double linked lists/DAGs) seem like fighting with the borrow checker. Or the issues to be solved with upcoming 1.3 changes for pattern matching.
Yes, they're tough. This is a downside of manual memory management (though one that can be improved in future iterations). But doubly linked lists/tree-like data structures are hard in Haskell too. "Tying the knot" is not exactly easy or intuitive.
- pjmlp 11y ago> Are you implying that these actor libraries give you the data race freedom guarantees that Rust's mutability rules give you? If so, that's trivially false. No they don't give the freedom, but they give them comfort for the average developers. I deal a lot with 9-5 enterprise developers that don't even know that HN and Reddit exist, or whatever languages exist out there besides what they use on the job. Yet they do write multi-threaded code with help of such libraries, happy that someone gives them training wheels. > But doubly linked lists/tree-like data structures are hard in Haskell too. True, but laziness helps. However Haskell is hardly a mainstream language.
- pcwalton 11y ago> Yet they do write multi-threaded code with help of such libraries, happy that someone gives them training wheels. And they create a lot of bugs in the process. Empirically, a message passing framework does not eliminate data races as a very common class of bug. > However Haskell is hardly a mainstream language. Well, you brought up Haskell earlier. I agree of course that both Rust and Haskell make it hard to write doubly-linked lists and trees, and that Haskell is not a common industry language.
- pjmlp 11y agoHaskell was just one of the languages on my list. I was basically referring to all languages with available compilers and better web frameworks than what Rust currently offers. And I did miss a few ones. As for data races elimination, I don't see people really moving away from those libraries, but I might be wrong.