[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: So, what the heck is a continuation anyway?
At 12:26 PM 12/10/2001 -0700, Jeffrey Palm wrote:
>Dan Sugalski wrote:
>>At 07:08 PM 12/10/2001 +0000, Seth Gordon wrote:
>>>Generally speaking, when you call a function, your program explicitly
>>>says "evaluate this function with such-and-such arguments". The
>>>interpreter translates this to "evaluate this function with
>>>such-and-such arguments, and return the value and the control of
>>>further execution to *here*."
>>>That "*here*" is the continuation. If the programmer can get explicit
>>>control of the continuation, then he or she can do perv^H^H^H^Hinteresting
>>>things, since a function can return values to somewhere other than its
>>Oh, I see. A continuation is a function call where, not only do you get
>>to decide what you return, you get to decide where you return it to.
>>That's evil. I really like it. :)
>>Are there general rules as to where you're allowed to return to? I
>>presume picking PC addresses out of the air's considered bad form.
>A continuation isn't a function call, when you resume a continuation
>control goes to the point the continuation was captured.
More a continuation is a spot a function call can return to instead of the
spot it was called from?
Something like altering the return address pushed onto the stack by a sub
call, with a bit of stack frame twiddling on return just for good measure?
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
firstname.lastname@example.org have teddy bears and even
teddy bears get drunk