fez
fez copied to clipboard
RFC 2: Async
All IO in erlang is "async" (non blocking) so for that kind of code async can effectively be erased.
In the case of Async.Start*
we could potentially compile these to spawn new processes to provide parallelism. It would require careful design but may be worthwhile.
IO isn't async for the process that is calling it by default. I'm not sure how the Async IO operations work in fsharp but if you need to look into doing them in more of an async manner you can.
This is the blocking code: https://github.com/erlang/otp/blob/maint/lib/stdlib/src/io.erl#L572
https://github.com/elixir-lang/elixir/blob/master/lib/logger/lib/logger/backends/console.ex https://medium.com/@olafura/faster-elixir-logger-part-1-8f5424396943 https://medium.com/@olafura/faster-elixir-logger-part-2-ddb328eb31f4
Thanks for the comments. Fsharp async (and c# async for that matter) is mostly a hack around the fact that .NET allows you to block the calling thread when doing io. Erlang doesn’t allow this as naturally there is no direct interaction with threads. So when I said non blocking above I meant it in the .NET sense. :) I admit that isn’t clear.
Async can also be used to dispatch work on the threadpool which has a better translation to erlang.
I’ve implemented this partly already where async.start will spawn a new process to execute a computation on.
Couldn't you go for Hopac now that you have a chance to do it well? It's a much stronger, more stable abstraction than Async.
See my comment in #34