How do typed languages implement the actor pattern?

I’ve read on this forum a couple times that Philip Wadler attempted to add static types to Erlang and stumbled on messages and pids/self. However, I know there are statically typed languages out there that have an actor library. (Rust, C#, Scala, Haskell, etc)

So, my question is, how do they implement the actor pattern and handle those issues?


Here is Haskell’s stab at the problem:

basically you explicitly specify the message types up front in the type definition.

I suspect Wadler’s problem wasn’t typing Actors in general, but typing the OTP specifically.

It’s been a while since I looked at OTP with Dialyzer in hand, but it’s not pretty… : /


Actix is Rust’s version of it, it uses the interface to ‘constrain’ a PID to accept certain message types down (though it can accept more) or you can go through a dynamic call (basically black-boxing the message like all messages on the BEAM are), which is less instantly efficient but can pass anything anywhere.

Akka for Java is Java’s implementation of it, it has the pure dynamic interface only, however it recently (couple years ago) got a typed layer on it, a summary of how to use it: