@kraythe It sounds like you're precisely describing Agents
<http://doc.akka.io/docs/akka/snapshot/scala/agents.html>: actors with a
single mutable variable, whom you send functions to to execute on, which
will all get executed serially.

I don't know why they're not popular in Akka, but they're there. I know the
Clojure people use them all over the place
http://clojure.org/agents?responseToken=03d29a81a9ea9b76cff24e1bb1c6dc369

On Sat, Aug 22, 2015 at 6:59 PM, kraythe <kray...@gmail.com> wrote:

> Bad example since all strings are immutable. If you included mutable state
> that would be bad. I am not talking about that. Im talking about a function
> that does not use mutable state and just uses the information in the
> message.
>
> On Saturday, August 22, 2015 at 4:26:23 PM UTC-5, Ryan Tanner wrote:
>>
>> My example was meant to illustrate why sending functions to actors is
>> dangerous.
>>
>> On Saturday, August 22, 2015 at 1:04:14 PM UTC-6, kraythe wrote:
>>>
>>> Sure this would be one idea. I guess the question revolves around
>>> whether it is good practice in reactive programming.
>>>
>>> On Saturday, August 22, 2015 at 11:28:01 AM UTC-5, Ryan Tanner wrote:
>>>>
>>>> case class SmartMessage(data: String, fn: String => Unit)
>>>>
>>>>
>>>> var mutableState: String = "this can change"
>>>>
>>>>
>>>> remoteActor ! SmartMessage("some data", x => println(x + mutableState))
>>>>
>>>>
>>>>
>>>>
>>>> On Saturday, August 22, 2015 at 8:12:02 AM UTC-6, kraythe wrote:
>>>>>
>>>>> I don't know what you mean by that. Callable or function
>>>>> implementation doesn't need to be serializable, only the data packaged 
>>>>> with
>>>>> the message needs to be. In my example everything is imminently
>>>>> serializable. I'm simply packaging implementation with message data
>>>>
>>>> --
> >>>>>>>>>> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to