Huh -- actually, this one surprises me, so I'd like to poke at it. I understand why your response works, but not why the OP's doesn't. Since it's a value class, I would have expected the OP's version to result in the same bytecode, and I do think his version makes more sense semantically.
Granted, this is more a Scala-language question than an Akka one, but can you give a little insight into why that doesn't work at runtime? On Thu, Dec 15, 2016 at 3:57 AM, Viktor Klang <viktor.kl...@gmail.com> wrote: > You missed that they are value classes. ;) > > Try: > > val valueRef = system.actorOf { > Props(classOf[ValueActor], 10) > } > > > On Thu, Dec 15, 2016 at 8:28 AM, Dmb <bunadmit...@gmail.com> wrote: > >> I'm reading the documentation >> <http://doc.akka.io/docs/akka/2.4/scala/actors.html#Edge_cases> about >> actors and now I'm at the section about actor creation. This is an example >> I tried: >> >> >>> case class MyValueClass(v: Int) extends AnyVal >>> >>> class ValueActor(v: MyValueClass) extends Actor { >>> override def receive: Receive = { >>> case _ => println("Received message") >>> } >>> } >>> >>> >> When creating the actor as following: >> >> val valueRef = system.actorOf { >>> Props(classOf[ValueActor], MyValueClass(10)) >>> } >>> >>> >> I actually got the *IllegalArgumentException*. But what's wrong with >> that? To me, creating actors with value classes as parameters seems >> completely innocent. What did I miss? >> >> -- >> >>>>>>>>>> Read the docs: http://akka.io/docs/ >> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c >> urrent/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 https://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Cheers, > √ > > -- > >>>>>>>>>> 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 https://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- >>>>>>>>>> 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 https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.