3 ms·
Pony's model is different than Erlang's, so trying to think of it in terms of Erlang's model ("entering receive loop") may not be helpful when trying to underst
by aturley 8y ago
Pony's model is different than Erlang's, so trying to think of it in terms of Erlang's model ("entering receive loop") may not be helpful when trying to understand it.
The Pony runtime takes care of scheduling an actor to run when there is a message for that actor. The actor runs through the behavior and then waits to be scheduled again by the runtime when another message is available. If you want to filter messages you need to arrange a way to do that in your code. There's no way to inspect the message queue.
- abritinthebay 8y agoSo kind of like the RabbitMQ worker/message/job dynamic?
- aturley 8y agoPony uses a queue for storing messages that have been sent to an actor, so that's probably a reasonable way to start thinking about it. I'm not sure how far I would stretch this comparison, though. :)
- spooneybarger 8y agoThis might be a little hard to converse on over HN comment. If you stop by the #ponylang channel on freenode, it would be easier to discuss as there would probably be a lot of back and forth.
- zzzcpan 8y agoI get it, it's like event driven programming with static event handlers per actor. Where you can't express a wait for a specific message directly in the body of the function. But you still have to do it somehow, which is what my question was about, how do people do it in Pony. Typically in event driven systems to do this either nested callbacks are used or higher order programming (futures/promises, etc).
- spooneybarger 8y agoYou can use callbacks, state machines, promises. All are available as options to use.