top | item 44548671 (no title) osa1 | 7 months ago No idea what that means.. Do you have a concrete example of what CPS allows and async/await doesn't? discuss order hn newest mikojan|7 months ago I believe async/await means you have a single consumer (caller) and a single producer (callee) and only a single value will be produced (resolved).With CPS you may send and receive many times over to whomever and from whomever you like.In JavaScript you may write.. const fetchData = async () => { // snip return data; } const data = await fetchData(); And in Go you might express the same like.. channel := make(chan int); go func() { // snip channel <- data; }() data := <-channel But you could also, for example, keep sending data and send it to as many consumers as you like.. go func() { for { // Infinite loop: // snip channel1 <- data; channel2 <- data; channel3 <- data; } }()
mikojan|7 months ago I believe async/await means you have a single consumer (caller) and a single producer (callee) and only a single value will be produced (resolved).With CPS you may send and receive many times over to whomever and from whomever you like.In JavaScript you may write.. const fetchData = async () => { // snip return data; } const data = await fetchData(); And in Go you might express the same like.. channel := make(chan int); go func() { // snip channel <- data; }() data := <-channel But you could also, for example, keep sending data and send it to as many consumers as you like.. go func() { for { // Infinite loop: // snip channel1 <- data; channel2 <- data; channel3 <- data; } }()
mikojan|7 months ago
With CPS you may send and receive many times over to whomever and from whomever you like.
In JavaScript you may write..
And in Go you might express the same like.. But you could also, for example, keep sending data and send it to as many consumers as you like..