This issue is food for thought as a design for Ada's analogue of C#'s await. Since Roslyn generates a lambda (anonymous local function) to implement an await, it is conceivable that the Ada-WinRT binding-generator tool could generate an analogous •named• (i.e., not-lambda) Ada subroutine to be called (back) when the operation completes. The lack of name is mere convenience in the lambda. Indeed even being a local function seems to be mere convenience in the lambda at the heart of await because that generated lambda seems to not absolutely crucially need to bind to any data allocated on the call-stack, other than to provide some sort of context to identify multiple concurrent invocations of the same async subroutine.
This posting on StackOverflow seems to be a lucid description of how C#'s await works (well) under the hood. Since Ada-WinRT has a code-generator at its disposal, some of the same tricks that Roslyn does as a compiler with an AST, the Ada-WinRT could conceivably (at least partially, with generated named subroutines, lay similar groundwork to) do for each async method in WinRT components.
Also, this blog posting is Kenny Kerr's intro to 1) a callback interface-mixin solution and 2) a co-routine solution to how the analogue of C#'s await could appear in C++/WinRT for an async subroutine. In variant 1, Kenny Kerr's implements<MyAsync, IAsyncAction, IAsyncInfo> seems to be similar to the callback alternative that you mention on the README.md regarding your current busy-wait-loop approach to an analogue of await in Ada.
This issue is food for thought as a design for Ada's analogue of C#'s
await. Since Roslyn generates a lambda (anonymous local function) to implement anawait, it is conceivable that the Ada-WinRT binding-generator tool could generate an analogous •named• (i.e., not-lambda) Ada subroutine to be called (back) when the operation completes. The lack of name is mere convenience in the lambda. Indeed even being a local function seems to be mere convenience in the lambda at the heart ofawaitbecause that generated lambda seems to not absolutely crucially need to bind to any data allocated on the call-stack, other than to provide some sort of context to identify multiple concurrent invocations of the same async subroutine.This posting on StackOverflow seems to be a lucid description of how C#'s
awaitworks (well) under the hood. Since Ada-WinRT has a code-generator at its disposal, some of the same tricks that Roslyn does as a compiler with an AST, the Ada-WinRT could conceivably (at least partially, with generated named subroutines, lay similar groundwork to) do for eachasyncmethod in WinRT components.Also, this blog posting is Kenny Kerr's intro to 1) a callback interface-mixin solution and 2) a co-routine solution to how the analogue of C#'s
awaitcould appear in C++/WinRT for anasyncsubroutine. In variant 1, Kenny Kerr'simplements<MyAsync, IAsyncAction, IAsyncInfo>seems to be similar to the callback alternative that you mention on theREADME.mdregarding your current busy-wait-loop approach to an analogue ofawaitin Ada.