stack-switching
stack-switching copied to clipboard
Support for different response computation styles
When a computation suspends, the code that responds to that suspension denotes the response computation.
In some situations, it is legitimate that the response code is textually associated with the prompt bracket. In other situations, it is more appropriate for the response code to be associated with the suspension itself. In yet more cases, it should be dynamically computed; in an analogous manner that functions may be dynamically computed.
If the scenario for the suspension is simple: all suspensions are essentially of the same kind and for the same reason then associating the response code with the prompt bracket may make organizational sense.
However, in many cases, the reason for each suspension is slightly different. In which case associating response code with the prompt bracket requires additional signaling between the suspending computation and the responding computation. By associating the response code with the suspension bracket this signaling can be eliminated.
There are likely scenarios for each of the possible patterns and therefore being able to support multiple patterns seems to make sense.