2 ms·
Relating Pony to some of the languages mentioned, two that seem immediately comparable are Akka and Erlang. "Akka’s receive operation defines a global message
by mcguire 9y ago
Relating Pony to some of the languages mentioned, two that seem immediately comparable are Akka and Erlang.
"Akka’s receive operation defines a global message handler which doesn’t block on the receipt of no matching messages, and is instead only triggered when a matching message can be processed. It also will not leave a message in an actor’s mailbox if there is no matching pattern to handle the message. The message will simply be discarded and an event will be published to the system."
"[In Erlang,] receive statements have some notion of defining acceptable messages, usually based on patterns, conditionals or types. If a message is matched, corresponding code is evaluated, but otherwise the actor simply blocks until it gets a message that it knows how to handle."
Pony's message passing is syntactically similar to its methods, with a "be" (for "behavior") keyword introducing a handler rather than "fun". As a result, the message receive operation is global, like Akka, but the type system ensures that an actor cannot be sent a message it does not recognize. These are both different from Erlang, which has a local receive operation. An Erlang process, upon receiving an A message, can call another receive statement and block only looking for B messages. At that point, any incoming A messages will queue up. That has always seemed to me to be a good way to write deadlocks without realizing it.
Pony is otherwise similar to a typed Erlang that compiles to machine code and doesn't (currently) have process monitoring. [:-(]
There was some discussion about distributed Pony, but it has rather strong semantics for message passing, which would require a rather complex underlying protocol. [I'd rather have simple distributed messages and handle failures at the program level.]
[I only have experience with Erlang and Pony; I'm hoping my description of Akka is true from the discussion in the post.]
- rurban 9y agoPony is a bit different to a typed Erlang though: * Pony has two message passing options: copy or share (by ref). Both are safe, Erlang does only copy. * Pony is non-blocking only, there are no blocking calls in any stdlib function. * Erlang supports no native threads, only green threads. So it favors IO over CPU, distributed computing on different cores is only via distributed nodes. * Pony supports native threads, but no distributed actors on different hosts yet. * Pony is massively faster, uses much less memory, and has better cleanup via a clever GC protocol.