Re: [akka-user] Creating Actor w/ Props having Value Class Argument(s)

2016-07-23 Thread Johan Andrén
Hi Kevin, If you scroll down a bit from where you linked into the docs you can see the variations of prop factory methods and how to make it work with a value class (http://doc.akka.io/docs/akka/current/scala/actors.html#Value_classes_as_constructor_arguments) Reflection is used when you do

Re: [akka-user] Creating Actor w/ Props having Value Class Argument(s)

2016-07-22 Thread Kevin Meredith
Thanks for the minimal example, Konrad. On a side note, why is it necessary to use reflection (or possibly a macro) in order to construct an Actor? On Wednesday, July 20, 2016 at 11:48:15 AM UTC-4, Konrad Malawski wrote: > > This basically demonstrates the core of the problem: > > scala>

Re: [akka-user] Creating Actor w/ Props having Value Class Argument(s)

2016-07-20 Thread Konrad Malawski
This basically demonstrates the core of the problem: scala> class Meter(val m: Int) extends AnyVal defined class Meter // in runtime you have *no way* to check if it's an AnyVal extending class or not. We would have to use macros. (scala reflection is a bit iffy...) scala> val m = new Meter(12)

Re: [akka-user] Creating Actor w/ Props having Value Class Argument(s)

2016-07-20 Thread Kevin Meredith
Hi Konrad - Could you please give me an example that demonstrates the "so we can't ..."? >AnyVal is a Scala compiler optimisation, so we can't figure out the right constructor (always / safely) in runtime. Thanks On Wednesday, July 20, 2016 at 9:44:33 AM UTC-4, Konrad Malawski wrote: > >

Re: [akka-user] Creating Actor w/ Props having Value Class Argument(s)

2016-07-20 Thread Konrad Malawski
Because the type (wrapper) is not there at runtime. AnyVal is a Scala compiler optimisation, so we can't figure out the right constructor (always / safely) in runtime. A resolution would be to "if thing has one field, and that value matches we use that field" which could lead to very weird

[akka-user] Creating Actor w/ Props having Value Class Argument(s)

2016-07-20 Thread Kevin Meredith
Looking at the Akka docs for creating an Actor: The recommended approach to create the actor Props is not supported for cases when the actor constructor takes value classes as arguments. Please explain the "is not supported ..."