These are chat archives for petabridge/akka-bootcamp

Apr 2016
Artur Karbone
Apr 13 2016 04:45

In bootcamp it is written and i'm quoting here:

"Remember: do NOT try to create Props by calling new Props(...).When you do that, kittens die, unicorns vanish, Mordor wins and all manner of badness happens. Just don't do it"

At the end of the day under the hood Create method calls new Props directly though:

 public static Props Create<TActor>(params object[] args) where TActor : ActorBase
            return new Props(typeof(TActor), args);

I understand that having factory method like Create is a good practice for many reasons: It is generic, it has ActorBase
restriction, etc.

However, if it is so bad using new Props(...). Why just don't mark the constructor as an internal or protected?

Any comments?

Aaron Stannard
Apr 13 2016 14:37
basically, people fuck it up
if they don't use the expression syntax
it's a matter of time
one day you change the signature of a constructor and nothing stops working and you didn't get a compile-time warning