These are chat archives for akkadotnet/akka.net

23rd
Jul 2016
Ismael Hamed
@ismaelhamed
Jul 23 2016 07:43
In scala, I've noticed it is almost mandatory to define a Props factory in the companion object. Is it advisable to do the same in .NET?
object EchoConnectionHandler {
  def props(remote: InetSocketAddress, connection: ActorRef): Props =
    Props(new EchoConnectionHandler(remote, connection))
}
...
sender ! Tcp.Register(context.actorOf(EchoConnectionHandler.props(remote, sender)))
Bartosz Sypytkowski
@Horusiath
Jul 23 2016 08:18
@ismaelhamed it's not mandatory, it's just a good practice
Ismael Hamed
@ismaelhamed
Jul 23 2016 08:21
So, would it be a good practice too in .NET? I don't recall having seen it in any sample so far
Sergey Kostrukov
@kostrse
Jul 23 2016 09:32
I can assume that the practice is not popular in Akka.NET because here we have it through Linq expressions. The same result, just different language technique.
Sergey Kostrukov
@kostrse
Jul 23 2016 09:41
A method in companion object is a good practice in Scala because it guarantees that you didn't catch object closure accidentally. I don't know if Linq safes from accidental closure.
Ismael Hamed
@ismaelhamed
Jul 23 2016 10:06
I liked the idea of having the Props defined in the actor itself, though
Arsene Tochemey GANDOTE
@Tochemey
Jul 23 2016 11:11
Please do Actor states need to be set readonly?
Bartosz Sypytkowski
@Horusiath
Jul 23 2016 11:26
@Tochemey they don't need to be readonly
Arsene Tochemey GANDOTE
@Tochemey
Jul 23 2016 11:27
Thanks