[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: So, what the heck is a continuation anyway?



   From: Dan Sugalski <dan@sidhe.org>

   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.

In Scheme, the "call-with-current-continuation" form basically allows
you to say, "I want other functions to be able to return their values
*here* instead of to their callers", and then you can refer to
"*here*" with the variable name of your choice, and then pass that
variable to other functions.

The bad form comes when you start doing things like using the same
continuation more than once.

-- 
"If I don't know what I'm doing, I program in Scheme. If I don't want to be
allowed to not know what I'm doing (possibly for the sake of efficiency or
safety), I program in SML. If I want to get paid, I program in C++."
  --Thant Tessman
== Seth Gordon == sethg@ropine.com == http://ropine.com/ == std. disclaimer ==