4 ms·
I'm trying to grasp the whole fuss about the colors of the functions still, and yes, I did read all the related posts back then, and skimmed them today as a ref
by egeozcan 5y ago
I'm trying to grasp the whole fuss about the colors of the functions still, and yes, I did read all the related posts back then, and skimmed them today as a refresher.
You can call an async function in a sync context. You just can't unwrap the value from the result container, as it's not available. But you do get a result, which is Promise<T>.
Any language that has concurrency, pointers or any mechanism that allows the value to change from under your feet has colored functions, doesn't it?
Also IMHO: Not being able to use "await" or not depending on the context, and wrong usage being a parse error, is much better than black magic happening at the compilation.