Hello, I hope someone will take the time to read this message (sorry about its length) and help me.
I'm writing a fairly large system from scratch in Scala. I love the rich typing and functional programming style, and I have experience with future-based programming, but not actors. When I try to use actors, I feel like I'm giving up static typing, even the basic feature of a type declaring its methods (=received messages). Using partial functions feels like casting, because I really want to assert that the 'partial' function will always match. This can't be right. How do you reconcile the two worlds? Specific issues I'm struggling with: 1. Typed code is discoverable via methods and fields. An actor relies on documentation. One option is to define all messages an actor can receive in its companion object, and document each message; but many libraries (e.g. spray) define many different actors that all send and receive the same types (eg HttpRequest), which is convenient for forwarding messages between actors. But then the *only* way to figure out which messages are legal and the semantics of what they do is to read the docs. When an actor manages complex state and might receive ten or twenty different message types, this is hard to manage. Even if I document the actor, this documentation is still not discoverable because the client has an ActorRef, not an ActorRef[MyActorTrait]. So I have to figure out manually what behavior this actor is expected to implement and read the docs for that. 2. Refactoring actors is hard. To make a non-backward-compatible API change to an actor, I have to go over all references to the message types involved. No more 'find all usages of method' or 'rename method'. 3. Typed Actors lack important Actor features (become/unbecome, etc), have to declare exceptions, suffer a proxy performance penalty, and aren't recommended as a replacement for actors in general. I understand that features like become() and remoting make it difficult to type actors, and maybe this is just an unsolved difficult problem. So how do mature actor-based projects handle these issues? How can I have the benefits of both actors and static typing? TIA for any insight. Daniel Armak -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.