Marc Feeley wrote:
Why do you want to do this? In Scheme you can code in direct style, and use call/cc when you want to access the continuation. The overall structure of your code should be much clearer than CPS'ed code.
I realized after a couple more days of reasearch that I'm confused. What I really want to do is code state machine with call/cc since I have an event-driven application. I couldn't figure out how to do this, though.
I'm thinking that I should have a single "dispatch-event" function as entry into scheme. This function would deserialize the event and figure out which state machine it belongs to. This part I have no trouble with.
I cannot figure out, though, how to use call/cc to move the state machine from one state to the next upon event. When an event arrives I need to pass it to the state machine and have it advance itself and return the outgoing packet or #f to signal that the exit state has been reached.
One thing that confuses me is that it seems that I need to return the continuation (not sure if I actually need to) but then I also need to return the outgoing event/packet from my "entry-into-scheme-dispatch- function".
Thanks, Joel