[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Demystifying Continuations
David Simmons wrote:
> ...continuations seem to be a very simple
> concept that is much more easily understood in terms of stacks,
> call-chains, and frames (activation-records/contexts).
It is a simple enough concept (although its applications can be complex), but I think continuations are more easily understood in the terms you describe, only if those are the terms in which you already think.
As an abstraction, continuations provide real advantages. Try to describe the things you can do with continuations in terms of stacks/callchains/contexts - I think you'll find that the continuation description will be simpler every time. That's why they're used in computing science - they're a more powerful abstraction, which leads to more concise descriptions.
However, you seem to be talking more about how continuations can be implemented, than about how they're used. If you're implementing continuations, then your stacks/callchains/contexts are perfectly valid (and common) implementation strategies.
Thinking about high-level concepts in terms of their implementations can be quite misleading, though. For example, saying that "objects can be understood as arrays associated with a hashtable of functions" may have some technical validity, but it misses important aspects of the bigger picture. To see the advantages of continuations, you have to operate at the level at which they provide an advantage.
I think the best way to appreciate continuations is to forget about implementations and play with them in a pure functional environment, like lambda calculus or a Scheme subset. Like any exotic creature, they tend to make more sense in their native habitat...