W dniu piątek, 4 marca 2016 05:25:34 UTC+1 użytkownik Manar Elkady napisał:
>
> Hi, 
> I want to know the contradiction between these sentences from the 
> documentation
>  "Agents are bound to a single storage location for their lifetime, and 
> only allow mutation of that location (to a new state) to occur as a result 
> of an action"and "The state of an Agent should be immutable."
>
> There is no contradiction. Agent is a sort of a mutable reference but the 
object referred to should be immutable by itself. Otherwise different 
threads could concurrently modify the object, with all possible adverse 
consequences. 
The general rule in Scala is that it's OK to have a val pointing to a 
mutable object (say, an ArrayBuffer) or a var pointing to an immutable 
object (say, a Seq), provided that you keep them exclusive to a single 
thread. However, when you find a var pointing to a mutable object, 
something is amiss.


One more question about the usage of a concrete subclass for the abstract 
> class Agent[T]. What does it mean? how can we use it?
>
>
I don't think it's designed to be subclassed. You can create instances 
using companion object's apply method and just use them, as scaladoc 
illustrates.
If I misunderstood your question, please elaborate.

Cheers,
Rafał


> Manar,
>
> On Monday, January 25, 2016 at 8:52:28 AM UTC+2, Manar Elkady wrote:
>>
>> Hi,
>>
>> While I am implementing a multi-agent system application, I investigate 
>> akka.agent.Agent and I didn't notice any relation between agent in akka and 
>> the well known multi-agent concepts. Could anyone has an idea about that?
>>
>>
>> Manar,
>>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to