3 ms·
> Rust did not punt on concurrency early on. Rust started with green threading/fibers then quickly rejected that approach. Then it spent years iteratively buil
by wahern 5y ago
> Rust did not punt on concurrency early on.
Rust started with green threading/fibers then quickly rejected that approach. Then it spent years iteratively building an alternative solution, which is still underway.
That's punting in my book; and it's punting for the majority of Rust aficionados who are surprised by the various twists and turns things take as the solution (as inevitable as it is) slowly materializes. By contrast, nothing of substance about Go async has ever changed, except perhaps the change in the default value of GOMAXPROCS. It was complete at conception.
It wasn't a wrong decision that Rust made; it was just a choice. But 10 years out it's not entirely implausible that if Rust had stuck with fibers that it may have driven the required OS improvements (e.g. Google's User Managed Concurrency Groups (UMCG) Linux kernel patches) that would have resolved some of the issues. It's not like Rust has become ubiquitous in the embedded space either, considering that it's held back by LLVM in that regard.
Something similiar happened with fallible allocations. Very early on most Rust devs declared that they believed that attempting recovery from allocation failure was folly (which in the land of GUIs from whence most of them came was the near universal opinion), and so shot down attempts to consider fallibility in the APIs.[1] Cue 10 years of slowly walking that back, with iterative (and still mostly pending) changes that were less than ideal owing to the fact that handling allocation failures is made infinitely more difficult if you don't take it into consideration at day 1.
[1] And, no, it's not enough to say that Rust core is allocation agnostic, because setting aside that only a tiny minority of Rust programmers only stick to core, the decision involved setting idioms and practices surrounding panics.
- steveklabnik 5y agoOkay, we understand the word “punting” extremely differently then. Active work is the opposite of punting. And yeah, maybe in an alternative universe where everything is different, things would be different. But that zero-cost C interop is one of the only reasons Rust succeeded enough to be making it to the point where it’s conclusion is considered, let alone re-writing all of the primitives of all the current OSes and waiting until those are widely deployed enough to be able to use only them and ignore all those embedded users. I don’t possibly see a universe where that works out. But in theory it could happen I guess.
- kazoomonger 5y ago> But 10 years out it's not entirely implausible that if Rust had stuck with fibers that it may have driven the required OS improvements ... Rust would've been a language nobody had heard of. It wouldn't have driven anyone to do anything because it wouldn't have had widespread adoption in the first place. As-is I'm using it in embedded programming and loving it. I certainly would never have picked Go for that. I think you're not really understanding Rust's approach here. Green threads would be much too heavyweight to build into the language itself, and would mostly preclude it from being seriously used in interesting domains like embedded programming.
- kazoomonger 5y agoSince I can't edit the above comment, one additional thought is that your criticism is valid for a language like Python, which has a much higher tolerance for abstractions such as green threads being built into the language itself. It would've been interesting if Python had gone with a solution other than async/await. I'm also a little confused when you say "Rust started with green threading/fibers". I think the term "fiber" is overloaded here, but Rust did start with green threads (M:N preemptive multitasking). Rust now has support for cooperative multitasking via async/await. From what I can find of UCMG, it kind of misuses the term fiber. Looks like it's just green threads that the kernel is aware of?
- jkarneges 5y agoIt is an interesting thought experiment to imagine how things might have played out if Rust had kept green threads. I don't know if it would have changed the Rust vs Go story much. There'd still be the learning curve of the borrow checker, and many people using Go aren't necessarily doing a ton of concurrency. The Rust vs C/C++ story on the other hand... If Rust had a bunch of extra runtime stuff and limited interop, I suspect it would not have been perceived as a serious replacement, which may have hindered adoption. At least when I selected a language for my highly concurrent network server, I only considered C, C++, and Rust. I'll admit it's a fine line. I'm using async Rust, with an executor/reactor and all that jazz, and the end result may not be much different than if Rust had made those decisions for me. Having the power to make my own decisions is very appealing though. It's possible Go could have been a contender for my project if it wasn't such a limited language. And Mozilla's backing of Rust helped it vs other fringe options.