funscript

Async.RunSynchronously in funscript


async {
       return "asd"
    } |> Async.RunSynchronously

This piece is throwing a compiler exception saying that

"Could not compile expression: Call (None, RunSynchronously, [arg00, NewUnionCase (None), NewUnionCase (None)])"

Is RunSynchronously not implemented in funscript compiler at the moment?


Solution

  • It is not clear from the code example why Async.RunSynchronously is needed.

    Only Async.StartImmediate is mapped at the moment.

    This should be sufficient for most tasks. We didn't see the need to introduce a "blocking" method. JavaScript is executed on one thread. Therefore, there isn't any need for synchronization.

    If you need to do something with the result of the asynchronous computation I suggest that you push this inside the asynchronous workflow instead.