The Second Step: Akka Typed Channels
The previous post described the ground work, getting geared up to employ the power of macros within Akka and doing type calculations. This post focuses on the user-visible features which are enabled by the macro machinery, presenting a new face for actor communication. The untyped “receive” method is replaced by declaration of any number of different input channels (though the single-mailbox principle is kept); the untyped “!” operator is replaced by different ones to avoid confusion.
Makkros: First Step towards Typed Channels
The thought of wanting to support typed channels between our dear untyped actors has been on my mind since at least ScalaDays 2012, sparked anew by Simon Peyton-Jones’ talk about Haskell in the Cloud. But at the time the only means available was the Scala type system which—while certainly powerful enough—made this task daunting, to say the least. Scala 2.10’s macros change the game completely, as I’ll demonstrate in this post.