Why asynchronous Rust doesn't work
&gt; <i>Was spinning up a bunch of OS threads not an acceptable solution for the majority of situations? Could we have explored solutions more like Go, where a language-provided runtime makes blocking more of an acceptable thing to do?</i><p>I think this is the real fundamental disagreement here (well, at least with the async stuff). (And the comments slightly earlier, regarding &quot;the color of your function&quot;.)<p>The way I think about the various async stories out there (like, all of them, Go&#x27;s, Rust&#x27;s, Python&#x27;s, C w&#x2F; OS threads), is that they boil down to roughly three or so primitives: (I haven&#x27;t formalized this … and someday I should probably write a blog post on it, so it&#x27;s not going to be perfect.)<p><pre><code>  1. separate executions of code (threads, green or not, goroutines, etc.)
  2. selection (the ability to block on **multiple** threads, simultaneously,
     but return after *one* is finished or ready. It&#x27;s not join().)
  3. cancellation (the ability to interrupt and cancel a thread)
</code></pre>
&quot;Was […] OS threads not an acceptable solution?&quot; No: the selection story is terrible (without involving epoll. You&#x27;ll pretty much have to build this out around conditions, and it&#x27;s painful), and the cancellation story is close to non-existent (you have to somehow transmit to the thread that it should cancel, and then that thread needs to obey it). In combination, some things are outright impossible: if you&#x27;re blocking on a socket recv in a thread, how do you get notified if you were cancelled? (You literally can&#x27;t, with the primitives that most OSes offer, without resorting to hacks, or epoll.) (Some OSes have calls to kill threads. They are basically one-way tickets to UB.)<p>Golang&#x27;s solutions get closer, but I don&#x27;t think they&#x27;re appropriate for a systems language that cares about low-level performance &amp; memory layout to the degree that Rust does.¹ But even golang struggles here: the cancellation story is missing. Golang&#x27;s approach here is retroactive: you have a context object, and you must thread it through function calls to anywhere it might be required. If your API didn&#x27;t think to do that, you&#x27;re SOL as a consumer, but worse, even as a coder, adding it is going to be a right PITA.<p>This isn&#x27;t to say Rust&#x27;s story is perfect here, either: it is tempting to think that dropping a future is cancellation, and it is very, very close (it provides a decent default). But sometimes cancellation also needs to propagate across an I&#x2F;O boundary (usually, across a network socket to a server, to cancel a request) and those are async. (I think there is some work being done in Rust with asynchronous drops.)<p>These problems show up in JavaScript — whose Promise lacks cancellation — and Python (which has cancellation via raising CancelledError; also, Python really, IMO, messed up the terminology. Between futures, coroutines, tasks, and awaitables, there&#x27;s ~2 <i>real</i> types (futures and tasks), and the rest are … IDK, weird distinctions that are hard to keep straight.)<p>¹Now, this is the heart of the other part of the article, the half about closures and fn types. Rust cares about ownership (as it allows programs to avoid not just memory issues, but a whole host of bugs resulting from ownership confusion that happen even in memory-safe languages like Python) and it cares about the performance implications of things like dynamic dispatch, or separate allocations for the data associated with the callback that you want to pass. And between trait types &amp; generics, it lets you choose, but that does result in some verbosity. You can also choose Arc, but some of us don&#x27;t want that in all cases.<p>(I don&#x27;t agree with the &quot;color of your function&quot; argument&#x2F;article, either: async functions in Rust are fundamentally still functions, they just return a Future&lt;T&gt; instead of a T. That distinction is <i>important</i>; we&#x27;re not just after the T, and the future is something we&#x27;re going to block&#x2F;wait on; it is its own type, with its own operations — specifically, and more or less, the ones above! —, that are crucial to how the code functions.)