title: Is it possible to get a StackOverflow error with event-driven recursive actors at all?
body: <p>As it's said in the comments, <a href="https://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_8_1_final/src//actors/scala/actors/Reactor.scala#L277" rel="nofollow"><code>Combinatiors.loop</code></a> of the standard actors library is intended to save you from stack overflows, when the body of an actor is repeatedly executed. </p>
  
  <p>But, does it make any sense to use <code>loop</code> for an event-driven actors (<code>react</code>), when message handling is, in fact, [almost] always scheduled to be executed in a dedicated thread pool? Simple recursive call of the body seem to be a more efficient option.</p>
  
  <hr>
  
  <p>Method <code>Reactor.seq</code> (called by <code>Combinatiors.loop</code>) is defined as follows:</p>
  
  <pre><code>  private[actors] def seq[a, b](first: =&gt; a, next: =&gt; b): Unit = {
      val killNext = this.kill
      this.kill = () =&gt; {
        this.kill = killNext
  
        // to avoid stack overflow:
        // instead of directly executing `next`,
        // schedule as continuation
        scheduleActor({ case _ =&gt; next }, null)
        throw Actor.suspendException
      }
  first
  throw new KillActorControl
  </code></pre>
  
  <p>}</p>
  
  <p>Let's assume, <code>next</code> is called directly. In this case, <code>react</code> is executed immediately, <a href="https://lampsvn.epfl.ch/trac/scala/browser/scala/tags/R_2_8_1_final/src//actors/scala/actors/Reactor.scala#L127" rel="nofollow">message handling is scheduled</a>, and the actor is suspended. No room for stack overflows...</p>
  
  <p>Where am I wrong?</p>