Hacker News new | past | comments | ask | show | jobs | submit login

Ehh. I think it makes it a lot harder to understand what a continuation is if you say they’re closures.

Continuations capture the stack. Closures capture variables.




It is not wrong though. Once you reify the return continuation, a continuation is really just a closure, the stack is implicitly recovered by recursively following the captured return continuations. And with closures you do not necessary have a stack anyway but any arbitrary directed graph.


> Continuations capture the stack.

Yes, but if you take 'stack' too literally here then you'll think that `call/cc` copies the stack, when maybe it really doesn't.

> Closures capture variables.

Variables, yes, including the return address of the frame in which those variables are if that return address is make explicit (e.g., because of CPS conversion).

And now you can see that closures can be continuations if they implicitly capture the stack.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: