As I attempt to get things in a nice and tidy state, and clear up the loose ends...

Return continuations.

Right now they get stuck in P1, which is fine for easy access, but as has been pointed out that makes P1 part of the caller's state that has to be preserved, wedged in the middle of stuff that has to be twiddled with to make a call to a sub. Not good.

The sensible thing would seem to be to move the return continuation out-of-band, either onto the stack somewhere or in a separate spot. I'm leaning towards a separate spot, a return register in the interpreter structure, saved as part of the environment a continuation captures. We can still pass it in as P1, with the call code automatically sticking it into the return continuation slot after the caller's continuation is taken.

If that makes sense, let's do it. We can add in a RETURN op or something, that automatically invokes the return continuation in the interpreter struct. (Which, kinda amusingly, brings us back to callcc/return for sub calls and returns, completely hiding continuations from pretty much everyone in the normal course of affairs)
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to