This means that any side of the orElse can redefine the whole Behavior—the idea 
behind the And/Or combinators was to move towards an encoding of hierarchical 
state machines where the pieces progress independently of each other. Without 
this independence there cannot be decoupling of the combined pieces, which 
means that this construct does not implement compositionality in full.

An orElse method may make sense on partial Behaviors nevertheless, for pure 
code organization reasons. What do others think?

Regards,

Roland

> 26 okt 2015 kl. 13:15 skrev Artūras Šlajus <[email protected]>:
> 
> implicit class BehaviorExts[A](val b: Behavior[A]) extends AnyVal {
>   def orElse(b1: Behavior[A]) = new Behavior[A] {
>     val unhandled = ScalaDSL.Unhandled[A]
> 
>     override def management(ctx: ActorContext[A], msg: Signal): Behavior[A] =
>       orElse(_.management(ctx, msg))
> 
>     override def message(ctx: ActorContext[A], msg: A): Behavior[A] =
>       orElse(_.message(ctx, msg))
> 
>     private[this] def orElse(f: Behavior[A] => Behavior[A]) = {
>       f(b) match {
>         case `unhandled` => f(b1)
>         case other => other
>       }
>     }
>   }
> }
> 
> It got cut off somehow :)
> 
> When I think about it, when I used Or I intuitively expected it to work like 
> this. 
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
> >>>>>>>>>> <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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/akka-user 
> <http://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
twitter: @rolandkuhn
 <http://twitter.com/#!/rolandkuhn>

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

Reply via email to