async / await

bauss jj_1337 at
Fri Oct 8 06:38:17 UTC 2021

On Thursday, 7 October 2021 at 23:20:15 UTC, Imperatorn wrote:
> On Thursday, 7 October 2021 at 22:35:23 UTC, russhy wrote:
>> I don't think trying to replicate C# async/await is a good 
>> idea, it promotes creating bad APIs (GetThisAsync | 
>> GetThisAsync.ButSyncThisTimeToGetResult)
>> Zig's approach is cleaner imo
> I think you misunderstood me. What I meant was just the 
> async/await keywords

No, he understood you and is talking about the method 
implementations in C#.

But tbh. the solution is to provide both an asynchronous and a 
synchronous version of the method.


DownloadFile() would be synchronous, whereas DownloadFileAsync() 
would then be async.

That avoids the whole problem of calling an async method 
synchronous, because in general you shouldn't ever do that anyway!

More information about the Digitalmars-d mailing list