5 ms·
IIRC C# investigated virtual/green threads, but decided to drop it because of poor interactions with reentrant code from async/await. The fact that C# went all
by e3bc54b2 2y ago
IIRC C# investigated virtual/green threads, but decided to drop it because of poor interactions with reentrant code from async/await. The fact that C# went all in on async/await when it was the rage has prevented it from adopting a better solution. Java's conservative attitude fares better for such fundamental changes.
- neonsunset 2y agoThere is reason async/await got so popular after it was adopted by C# based in the early Async work in F# :) Stackful coroutines have their pros but they are not a better choice. Rust did not and will not adopt them nor any other serious systems programming language will. You don’t have to follow noisy style you often see - tasks compose nicely and express deferred operations incredibly well in a way that will not blow up on you in a surprising way. There is an ongoing Async2 project which will massively reduce task state machine overhead further by only ever paying for it in the code that actually suspends rather than the code that just forwards the calls or doesn’t. It will likely land as preview in .NET 10 and as full release in .NET 11.
- cyberax 2y ago> Stackful coroutines have their pros but they are not a better choice. Hard disagree. Coroutines are absolutely useless for anything non-trivial, as debugging them becomes a total hell. They are still a callback hell, just with a lot of sugary goo slathered on it. Coroutines also result in the "colored function" problem, that is fundamental for them. Meanwhile, Go lightweight threads just work. Debugging is simple, and you don't have to think about spooky actions at a distance from event loops that dispatch coroutines.
- neonsunset 2y agoPlease re-read my reply. Goroutines are stackful coroutines.
- namtab00 2y agoI only know C#'s async/await, and know nothing about goroutines / virtual or green threads. You seem knowledgeable on the matter, care to share some resources that might help me grok the differences?