One aspect of Akka that I have always been silent about appears right in the canonical Hello World! example. That is, the syntax for creating a class is Props:
val props = Props[MyActor]
Q. What mechanism in Scala allows you to specify a type parameter (ie [MyActor]) in this way? I assume this translates to the constructor / apply method on Props, which takes a parameter Class? For example, I assume this is equivalent to:
val props = Props(classOf[MyActor])
I always assumed that I classOfwas "special" and somehow tricked into using syntax []. Since I see that Akka, a third-party library, uses the same syntax, it would be great to see a simple REPL example demonstrating how I can use this syntax for my own classes.
source
share