Sorry for being slightly off-topic, but I would like to share
something I wish I discovered before: CML/Hopac.
There are a couple of related but distinct concerns actor libraries
try to solve:
* concurrency
* fault tolerance
* distribution
From my limited experience, if you are doing just concurrency + fault
tolerance in a single address space, Actors are a pretty bad way to
structure code for anything non-trivial. Concurrent ML seems to be
*much* more suited for this task due to its added flexibility. There
is now an F# library [1], thanks to Vesa Karvonen, that provides an
interface close to CML, with synchronous channels, selective
communication and nack's; it also provides a few baked-in
synchronization primitives (ivar, mvar, variations of locks). The
implementation is pretty good (performant), though tuned for gaming
rather than server apps at this point. I have a system I have written
in Actor style that caused multiple days of headaches, and today I
realize a lot of the things I was trying are trivial with CML. I wish
Hopac was available when I was writing it.
I have not programmed any complicated distributed systems or systems
with high demands for fault tolerance. Perhaps Actor style of
programming is necessary for those. Still, I think writers of Actor
libraries could benefit greatly from having CML combinators available,
especially at prototyping stage, as opposed to starting from bare F#
stdlib. Many patterns are easily expressed in CML, but can be
implemented with more performance by specializing code and using locks
or Interlocked.* patterns. So it sounds productive to prototype in
CML and rewrite performance-critical parts when design is ready.
I also saw Joinads extension for F# mentioned but have not tried
working with those. At a glance, it seems that Join calculus / joinads
should have the same benefits as CML. Not sure which is more
expressive, Joinads or CML, but both should be more expressive than
basic actors as in F# stdlib (MailboxProcessor). Perhaps Tomas can
comment on this.
[1]:
https://github.com/VesaKarvonen/Hopac
Thanks,
--A