Relation between Akka and scala.actors in 2.10

Spread the love

Question Description

  • The Scala 2.10 release notes says this: “Akka Actors now part of the distribution. The original Scala actors are now deprecated.
  • The latest Akka library (“Akka 2.1.0 for Scala 2.10”) mentions the following dependency:
             com.typesafe.akka:akka-actor_2.10:2.1.0
       and the following examples:
             import akka.actor.Actor
             class MyActor extends Actor {..}
             val system = ActorSystem("MySystem")

  • My project includes these libraries:
             org.scala-lang:scala-library:2.10.0
             org.scala-lang:scala-actors:2.10.0
  • In my classpath, I have no package called “akka”. I do see instead scala.actors, but it doesn’t seem deprecated.

    So, in which way are Akka Actors “part of the distribution”?
    If this is, indeed, the case, then am I still supposed to add the “akka-actor_2.10” library as a dependency?
    If so, do I use akka.Actor or the non-deprecated scala.actors.Actor ?

    Practice As Follows

    In scala 2.9.2 scala actors was part of scala-library.jar.

    If you download a scala-2.10.0 distribution it there are no actors in scala-library and both akka-actors.jar and scala-actors.jar are supplied.

    The latter is present for backwards compatibility and will be removed in a future major release.

    akka-actors is the replacement and what you should use for any new development (and look to move anything using scala-actors across when possible).

    If you have no current code in your project using actors you should probably reconfigure your project’s dependencies to remove org.scala-lang:scala-actors:2.10.0 and instead depend on com.typesafe.akka:akka-actors_2.10:2.1.0 if you want to use actors.

    I am not sure why there’s no deprecation annotation on the classes in scala-actors in 2.10.0 but I believe it’s to be added in 2.10.1.

    You can find more info on the migration guide.

    Leave a Comment

    This site uses Akismet to reduce spam. Learn how your comment data is processed.