This example shows the use of continuation-passing style to offload a long-running computation in an Actor without unrolling the code into an unwieldy state machine:
You're probably not supposed to use Actors this way.
It avoids a growing stack because react() clobbers the stack at each call (essentially forcing a tail-call). So for example the following program does not stack overflow:
Post a Comment