▲ | nextcaller 2 days ago | |||||||
In c#/python you are forced to await the whole chain, the compiler forces you. While in javascript it allows me without a warning. That's why it seems as if things work differently in javascript, if it allows me to (not) use await freely. (I don't remember if c# was just a warning or an error). | ||||||||
▲ | neonsunset 2 days ago | parent [-] | |||||||
No. It is best to verify assumptions first before presenting them as facts. It is irritating to see this everywhere as the quality of discussion keeps going down. In order to get the result of a promise in JS you have to await it (or chain it with 'then', much like .NET's 'ContinueWith' although it is usually discouraged). Consumption of tasks in .NET follows a similar pattern. Async implementations in .NET and Python have also vastly different performance implications (on top of pre-existing unacceptable performance of Python in general). The analyzer gives you a warning for unawaited tasks where not awaiting task indicates a likely user error. Which is why if you want to fire and forget a task, you write it like '_ = http.PostAsync(url, content);` - it also indicates the intention clearly. | ||||||||
|