title: CAF Promise Result
body: <p>In CAF, response promises allow an actor to send and receive other messages prior to replying to a particular request. My issue is how to use the result of that promise.</p>
  
  <pre><code>// function-based, statically typed, event-based API
    adder::behavior_type calculator_master(adder::pointer self) {
    auto w = self-&gt;spawn(worker);
     return {
  [=](add_atom x, int y, int z) -&gt; result&lt;int&gt; {
    auto rp = self-&gt;make_response_promise&lt;int&gt;();
    self-&gt;request(w, infinite, x, y, z).then([=](int result) mutable {
      rp.deliver(result);
    });
    return rp;
  }
  </code></pre>
  
  <p>};
  }</p>
  
  <p>I basically have to use the value of rp before the return statement. Please let me know if you have any ideas</p>