2 ms·
Then you should annotate the tricky diverging call site with async (see my other comment), instead of making it implicit and requiring annotation of the common
by gpderetta 3y ago
Then you should annotate the tricky diverging call site with async (see my other comment), instead of making it implicit and requiring annotation of the common expected case:
should_be_future = async async_function()
should_execute = async_function() # <--- await goes here
handle_future(should_be_future)
handle_result(should_execute)
- ikekkdcjkfke 3y agoI just don't run into many cases where I'm not immediately awaiting a task, so instead of littering the code base with async await and their return types all the way up, there could be a lighweight version that free's the thread up when waiting on a blocking call (I'm assuming the main reason we want to use async in C# is to free the thread up to do other tasks). NotAPromiseObject ReadCsv(FileFile file){ string content = waitfor File.ReadAsync(file) ...