There is an obvious way to make mixins for actors: take *receive, preStart, 
postStop* methods, override them and call super inside. Or make 
*List[Receive]* and fold the list to single partial function. Things become 
harder with the *become* method. I could modify it in such way that it 
would apply stored *List[Receive]* before new behaviour. But what if 
several mixins uses the *become* method? It still could be solved, but you 
should store behaviour as variable field for each mixin separately and fold 
them after changing part of it.

But things becomes too complicated when using FSM syntax sugar. Too many 
end-points need to be overridden to be practical. But still actor mixins 
are very compelling. It is a way to combine behaviours that shares state. 
You could not substitute mixins with spawning number of actors, because 
they would have separate states. Combining partial functions improves type 
safety a bit: instead of *PartialFunction[Any,Unit]* you could have 
*PartialFunction[A,Unit]* mixed with *PartialFunction[B,Unit]* giving 
*PartialFunction[Any,Unit]* as result. But each partial function has exact 
type specified and scala could check case statement for variant coverage.

So, could anyone suggest approach how to mix actors fully, like taking two 
*UntypedActor* and making one of them?

-- 
>>>>>>>>>>      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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to