Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advantages of actors over futures

Tags:

future

actor

I currently program in Futures, and I'm rather curious about actors. I'd like to hear from an experienced voice:

  • What are the advantages of actors over futures?
  • When should I use one instead of other?

As far as I've read, actors hold state and futures doesn't, is this the only difference? So if I have true immutability I shouldn't care about actors?

Please enlighten me :-)

like image 460
Thiago Avatar asked Jul 13 '11 17:07

Thiago


1 Answers

One important difference is that actors typically have internal state, and therefore theoretically, they are not composable; see this and this blog post for having some issues elaborated. However, in practice, they usually provide a sweet spot between the imperative and the purely functional approach. So if possible, it is recommended to stick to programming with only futures, but if the message-passing model fits your problem domain better, feel free to use actors.

like image 115
thSoft Avatar answered Sep 28 '22 13:09

thSoft