4 ms·
This explanation of continuations obfuscates more than it reveals. You say that a continuation is a reification of return addresses. But what's reification? Ne
by dfabulich 8y ago
This explanation of continuations obfuscates more than it reveals.
You say that a continuation is a reification of return addresses. But what's reification? Never mind that, what's a return address? It's a return closure that consists of a text address? You mean, text, like, a string, an array of bytes? Oh, uh, no.
And, if you're really trying to explain this to a C programmer: what's a closure? Who are you imagining talking to that already understands what a closure is but doesn't know what a continuation is? Closures are at least as confusing as continuations; arguably more so.
What's "the tail position"? What does it mean to reuse a stack frame? ("This is a key point.") Are they different from function frames?
Who does this explanation serve? Certainly not a JS programmer trying to learn for the first time how to use function* and yield. Not a C programmer.
I think this explanation is for a Scheme programmer playing Ockham's razor to define things in terms of the smallest possible number of other things. This behavior can entertaining, but it's not educational, not explanatory.
You can define arithmetic in terms of set theory, but that's not how we teach arithmetic to children. Similarly, we shouldn't explain continuations in terms of implicit return closures.
Try this: Continuations allow you to pause and resume functions. The paused functions fold up into "continuation" values, which you use to resume the function where it left off.
- vostok61 8y agoI disagree with your statement that grandparent's explanation was not educational. The explanation helped me, a primarily C programmer who has done some work in higher level languages. When I read "reification of return addresses" that helped the concept click in a way it has not before.
- nothrabannosir 8y agoI disagree. Parent's comment was crystal clear and actually had me thinking; "I gotta start using that." I've been struggling with explaining continuations for a long time. Passing a return address is a great explanation.
- naasking 8y agoIt's more than a return address though, since those are stateless. It's more like a return context since it can encapsulate state.