top | item 44548456

(no title)

osa1 | 7 months ago

By CPS do you mean lightweight threads + meeting point channels? (i.e. both the reader and writer get blocked until they meet at the read/write call) Or something else?

Why is CPS better and lower level than async/await?

discuss

order

phplovesong|7 months ago

Async/await tend to be IO bound, in zigs case hiw can i know what to use and when? Say i do a db call, thats clearly IO, and later do heavy CPU thing, now how do i know that the CPU thing does not block inside my async io thing?

I guess its pure luck if the io implementation can handle both, but who knows?

jufter|7 months ago

> how do i know that the CPU thing does not block inside my async io thing?

I think it's common sense to not interweave IO with long-running CPU, hence sans IO.

If you want to go that route, we already have solutions: goroutines and beam processes.

burnt-resistor|7 months ago

Because it allows multiple topologies of producers and consumers.

osa1|7 months ago

No idea what that means.. Do you have a concrete example of what CPS allows and async/await doesn't?