3 ms·
> In Erlang synchronous communication between actors works fine. There is no such thing as synchronous communication in Erlang! When coding in Erlang you bett
by klibertp 10y ago
> In Erlang synchronous communication between actors works fine.
There is no such thing as synchronous communication in Erlang!
When coding in Erlang you better remember this. The primitive operation in Erlang is the async message send and that's it.
Sync messages are built on top of async send, blocking receive blocks and a lot of overhead involving linking and monitoring (because the process you're sending to may die before the message arrives or before it can send the response).
All this is handled by gen_somethings (`gen_server:call` does this, for example), but sync messages are not the basic primitive in Erlang. They may work, but they are not trivially implemented - I know, I tried working without OTP for a while. I reimplemented a lot of edge-cases handling in my project back then and when I finally checked library sources I was shocked to learn that it was still less than a half of what was needed...
- Matthias247 10y agoI wrote synchronous communication, with which I meant the combination of a sending a request message and do a blocking wait for a response message. I'm aware that the pure message sending in Erlang is async. What I intended to highlight is that the "do a blocking wait for a response" part is possible in Erlang, but not in Pony or Akka (yes, you can do it in Akka, but it's not recommended for performance reasons).