3 ms·
> how mailboxes and message passing would really work in a purely functional language anyway, could be awkward to work with them. It works really well and intu
by Random_ernest 7y ago
> how mailboxes and message passing would really work in a purely functional language anyway, could be awkward to work with them.
It works really well and intuitively I would say, and even more; this is a common application to show the advantages of functional programming. Here is an article comparing sending messages asynchronously between threads in Elixir and Clojure (two common functional languages) https://bentomi.github.io/posts-output/2017-06-04-message-sending-clojure-elixir/ https://bentomi.github.io/posts-output/2017-06-04-message-se...
- hopia 7y agoElixir and Clojure are not pure functional languages at all. They allow you to perform side effects freely, such as sending messages to different threads. They're not reflective of what the actor model would look like when implemented in a more purely functional language. Moreover, I was mainly referring to using the actor model in a language with a static type system of functional languages (ML). What would be the type of the mailbox? The message? I believe even Facebook (Whatsapp) has struggled to find a solution to this question, they're developing a statically typed language on top of BEAM right now. There's been plenty of good discussion around implementing a strong static type system around BEAM, here's some bits for reference: https://elixirforum.com/t/how-hard-would-it-be-to-have-a-strong-typing-system-in-elixir/27192/9 https://elixirforum.com/t/how-hard-would-it-be-to-have-a-str...