Using a modified example from {coro}, it is unclear how to access the value of the function. Here we return n after the async function has completed.
async_count_down <- coro::async(function(n) {
while (n > 0) {
cat("Down", n, "\n")
coro::await(coro::async_sleep(1))
n <- n - 1
}
n
})
n <- async_count_down()
Running this results in a promise (expected) however, trying to get the value via n$finally() results in an error.
At present it seems that using async() is intended only for functions with side effects. Is that correct?