[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Demystifying Continuations
Your reply to me included a number of statements like this:
"explaining it in basic terms"
"how they actually worked"
"how they truly work -- in layman's terms"
"understand the first principles upon which an
abstraction's semantics are made manifest."
Implicit in all this is your particular focus on wanting to know how continuations are implemented, or to put it more generally, you want to understand the semantics of continuations by translating them from one model to another model that you're particularly interested in. Your "basic terms", "actual", "truly", and "first principles" are all references to a particular model which you're axiomatizing as most basic, actual, and true.
But one can define continuations mathematically without resorting to the kind of explanation you want.
Guy really hit the nail on the head here - as an implementor of a certain type of language, you're steeped in ideas like reifiable cloneable contexts, and that's the model that you want to translate continuations into. However, this isn't necessarily going to make for a wonderfully clear explanation for a broader audience, which is probably why most discussions of continuations don't go there. Implementing continuations is very different thing from understanding how to use them and even "how they actually work" (depending on your definition of "actually").
(BTW, papers on implementing continuations do exist - someone's already mentioned Clinger et al, "Implementation strategies for continuations".)
> The implementation approaches allow me to see through the
> apparently nebulous/unclear explanations of continuations
> so that I can observe and extract their true semantics.
That's also the reason I suggested studying them in a purer environment. Otherwise, I think you run the risk of confusing characteristics of the abstraction with implementation concerns. It's possible that what you see as nebulous and unclear is simply non-trivial to translate into your favored model.
> I was given the impression that I was completely missing some
> level of understanding/nirvana regarding continuations. To be
> honest, I do not see why they are so "wonderful"
Why they are wonderful is easy. :) Continuations provide a high-level mathematical abstraction for control flow. An abstraction which, despite any appearances to the contrary, is actually quite simple compared to most alternatives. If there's a nirvana that you're missing, it may exist on the other side of the mathematical fence, i.e. you're concerned with implementing first-class continuations in a programming language, but there *is* more to continuations than that specific set of concerns.
And again, that's why studying them in a continuation-oriented environment can be helpful. Can a C programmer who's never used an OO language really grok objects by implementing them within his programs? Maybe, but it sure seems like the hard way to do it.