Async / await

>async / await
Why is it so hard? How do you make sense of this concept?

Attached: maxresdefault.jpg (1280x720, 47.04K)

Other urls found in this thread:

lfe.io
twitter.com/SFWRedditImages

its not, retard

Because it's stupid. Just use a modern language with concurrency at it's core aka elixir

I don't care, I just use use Fork::Manager;

this

>async: a function marked as async can use await, returns a promise
>await: enter the named async function, when it returns its promise (which may be right away or after several more levels of nested awaitz) put it on the end of a queue then loop through the queue until one of the promises resolves (I/O is finished). Return to the function that awaited it, await now "unwraps" the promise.

They are a way of combining coroutines, threads and promises with syntax that resembles normal code.

Depends where you use it. In dotnet where it was used first and built for, it's as easy as naming a variable. In JS it's implemented in a very retarded and unintuitive way.

It's not hard when you use the readily-made executor like everyone. Try making your own executor from a minimal coroutine API like C++.

>try reinventing the wheel!
why?

Just build your language to handle coroutines and threads then promises and your extra syntax is normal code.

>spin up the threads

Attached: 1628725512918.png (600x800, 7.93K)

>aka Elixir
thanks but I'll stick with Clojure

It isn't that hard, even in JS. Why is it so hard for you?

> Just use a modern language with concurrency at it's core aka Golang
FTFY

I just make every call synchronous - if the content doesn't load, well, then it ain't gonna load.

Me? I just use Task for everything.

What's the difference between threads and coroutines?

Why not both?
lfe.io

People werent meant to think in the 4th dimension

>Hey user, can you clean the table why I prepare the food?
Yeah, concurrency is HARD, lmao.

More like can you clean the table unless I'm not cleaning and if I'm cleaning it mop the floor unless I'm moping the floor...

Only if you program in a retard language that is not meant for concurrency.