Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why is scala actors deprecated in 2.10?

Tags:

I was just comparing different scala actor implementations and now I'm wondering what could have been the motivation to deprecate the existing scala actor implementation in 2.10 and replace the default actor with the Akka implementation? Neither the migration guide nor the first announcement give any explanation.

According to the comparison the two solutions were different enough that keeping both would have been a benefit. Thus, I'm wondering whether there were any major problems with the existing implementation that caused this decision? In other words, was it a technical or a political decision?

like image 972
bluenote10 Avatar asked Jan 30 '13 12:01

bluenote10


People also ask

What are actors in Scala?

In Scala, an actor's behavior is defined by implementing the act method. Logically, an actor is a concurrent process which executes the body of its act method, and then terminates. In Akka, the behavior is defined by using a global message handler which processes the messages in the actor's mailbox one by one.

What are Akka actors?

What is an Actor in Akka? An actor is essentially nothing more than an object that receives messages and takes actions to handle them. It is decoupled from the source of the message and its only responsibility is to properly recognize the type of message it has received and take action accordingly.

How do you make an actor in Scala?

This is a bit of a tricky problem, because Akka actors are started asynchronously when they're passed into the actorOf method using a Props . At the ActorSystem level of your application, you create actors by calling the system. actorOf method. Within an actor, you create a child actor by calling the context.


1 Answers

I can't but give you a guess answer:

Akka provides a stable and powerful library to work with Actors, along with lots of features that deals with high concurrency (futures, agents, transactional actors, STM, FSM, non-blocking I/O, ...).

Also it implements actors in a safer way than scala's, in that the client code have only access to generic ActorRef. This makes it impossible to interact with actors other than through message-passing.
[edited: As Roland pointed out, this also enables additional features like fault-tolerance through a supervision hierarchy and location transparency: the ability to deploy the actor locally or remotely with no change needed on the client code.
The overall design more closely resembles the original one in erlang.]

Much of the core features were duplicated in scala and akka actors, so a unification seems a most sensible choice (given that the development team of both libraries is now part of the same company, too: Typesafe).
The main gain is avoiding duplication of the same core functionality, which would only create confusion and compatibility issues.

Given that a choice is due, it only remains to decide which would be the standard implementation.

It's evident to me that Akka has more to offer in this respect, being a full-blown framework with many enterprise-level features already included and more to come in the near future.

I can't think of a specific case where scala.actors is capable of accomplishing what akka can't.


p.s. A similar reasoning was made that led to the unification of the standard future/promise implementation in 2.10

The whole scala language and community have to gain from a simplified interface to base language features, instead of a fragmented scene made of different frameworks, each having it's own syntax and model to learn.

The same can't be said for other, more high-level aspects, like web-frameworks, where the developer gains from a richer panorama of available solutions.

like image 166
pagoda_5b Avatar answered Nov 11 '22 08:11

pagoda_5b