Remix.run Logo
nextcaller 2 days ago

I'm still not sure if function coloring is also a problem in javascript. The problem became very clear in other languages like python or c#. But in javascript i've been writing code only awaiting a function when I need to and haven't ran into issues. I might write some simple experiment to check myself.

neonsunset 2 days ago | parent [-]

Why is it not a problem in JavaScript but is one in C#?

nextcaller 2 days ago | parent [-]

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.

nextcaller 2 days ago | parent [-]

Oh sorry for irritating you, I will return to my pod.