Re:Async2 – The .NET Runtime Async experiment concludes
by bob1029 on Thursday August 22, 2024 @11:57AM
(#41321657)
> async/await is kind of viral
Exactly part of my concern. Hypothetically we've got 2 competing viruses now.
Re:Async2 – The .NET Runtime Async experiment concludes
by GordonS on Thursday August 22, 2024 @01:44PM
(#41322685)
Surely it's the same "virus"? Unless I'm mistaken, the async2 proposal wouldn't require any code changes, as it essentialy just moves compiler stuff to the runtime.
Re:Async2 – The .NET Runtime Async experiment concludes
by pjmlp on Thursday August 22, 2024 @03:33PM
(#41323678)
They still need to interop the old async with the new async, without requiring recompilation of everything, otherwise it is going to be another .NET Framework to .NET Core, which is still ongoing.
Re:Async2 – The .NET Runtime Async experiment concludes
by neonsunset on Thursday August 22, 2024 @04:38PM
(#41324207)
The current generated state-machine mechanism is not going away any time soon. Instead, Roslyn as well as any other compiler that targets CIL is expected, when appropriate, to stop generating state machines and start generating specially annotated method calls recognized by .NET.
This means that all existing libraries will continue working as is, and newly written or existing code that is compiled against e.g. C# 14/.NET 10(?) can automatically opt into new mechanism without user intervention. The write-up does cover the considerations for interoperability between these two models as well.
In fact, this will make using async from other CIL-based languages much easier as the burden of capturing the state and suspending/resuming the execution will be on the runtime rather than language compiler authors.
Re:Async2 – The .NET Runtime Async experiment concludes
by pjmlp on Friday August 23, 2024 @01:31AM
(#41326419)
The kind of scenarios where this kind of interop is put to test is when old code, without being recompiled, takes a subclass, an interface implementation, a member reference, a delegate, or a lambda, compiled with async2 model, as parameter, and everything works as expected.
Something that I hope they take into account, having new code calling into the old code, is the easy part of the problem.
Re:Async2 – The .NET Runtime Async experiment concludes
by andygocke on Friday August 23, 2024 @12:20PM
(#41330307)
Yes, we considered that and implemented a solution. Effectively, the runtime will generate thunk methods that will invisibly bridge between the two worlds. Calling (and overriding) regular async methods with runtime async methods will be stitched up by the runtime. The user will never see the difference.
True for code your team write, but async/await is kind of viral, and many libraries now only have async APIs, which makes them difficult to shoehorn into a threading approach.