[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: So, what the heck is a continuation anyway?
Dan, here's an explanation that should make sense to an assembly hacker:
One simple way to think of a continuation is
It's the stack.
At some point, while my program is running, I look at the stack and
think, "Hey, this is a useful computation -- maybe I'd like to come
back and do this later". I "capture" it. Think of that as making a
copy of the stack.
Later I say, "Hmm, that was a useful computation -- I'd like to do it
now". At that point, I use the copied stack.
Scheme asks, why use it only once? Use it as many times as you want.
So each time I use it, I have to copy it again.
There are lots of papers on how to implement continuations MUCH more
efficiently than this, but explaining them won't help you understand
the operation much more easily.
So, what's an example of a computation that totters on from stack to
stack? Think Web programming. See my lecture notes for more:
http://www.cs.brown.edu/courses/cs173/2001/Lectures/
Specifically, the lectures for
2001-10-01 Web Programming
2001-10-03 Converting Programs for the Web
2001-10-10-12 Continuations
Don't worry, the parens don't bite. (-:
Shriram