News for hackers. Stuff that matters.
Re:The borrowchecker is what I like the least about Rust by zozbot234 on Sunday July 20, 2025 @05:44AM (#44623421)
> are better than threads when you need many (say >100K) of them

Stackless coroutines are even more efficient for that case, and Rust makes them comparatively easy. (And slated to get even easier in future versions, as the async support is improved further.)

Moreover stackful coroutines/fibers as used in Golang also makes it infeasible to have seamless FFI with the standard C API/ABI, which cuts you off from the bulk of the ecosystem. There are other issues too with having fibers in a C-like systems programming language - see https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/p13... for a nice summary of them.

Re:The borrowchecker is what I like the least about Rust by dfawcus on Sunday July 20, 2025 @08:32AM (#44624575)
Alef (arguably one of the antecedent of Go) had stackful couroutines/fibers yet it could have had such a seamless FFI to the standard C API/ABI.

The plan9 libthread (which reimplemented the Alef concurrency model for C) did have seamless use of the C API/ABI.

The mechanism was that it had threads and coroutines, a function needing to make use of the C API in a seamless manner would simply run as a thread rather than a coroutine. It was then easy to share data as the CSP model (with channels) worked between both coroutines, threads, and coroutines within a thread.

So if one wishes to use stackful coroutines, and still have that seamless compatibility, an approach mixing the Go and Alef approaches would seem necessary. i.e. the Go migrating coroutines as a default, but with the option to use Alef like thread bound coroutines when necessary.

Re:The borrowchecker is what I like the least about Rust by zozbot234 on Sunday July 20, 2025 @08:35AM (#44624593)
> The mechanism was that it had threads and coroutines, a function needing to make use of the C API in a seamless manner would simply run as a thread rather than a coroutine.

This reintroduces the colored functions that we were trying to get away from in the first place, by adopting stackful coroutines/fibers. Why not use async at that point? I can understand that Alef didn't, because stackless mechanisms were not well understood at the time. But it's plausible that we can do better.

Re:The borrowchecker is what I like the least about Rust by torginus on Sunday July 20, 2025 @09:01AM (#44624822)
Stackless coroutines are what every language that has async/await (Js, C#) uses. I've seen them getting a lot of hate here for needing a special kind of method to run in and being less elegant than green threads.