Hacker News new | ask | show | jobs
by sillysaurus3 2864 days ago
That’s one option. But the unfortunate conclusion of that choice is that continuations leak a lot of memory. One shot continuations are better, since it frees up the variable references.
1 comments

I don't see how this is different from lambdas in general, in JS/Python/etc... wouldn't it only be held as long as the variables are alive? If you use the callback only once then they should be eligible to be freed after being used once.
http://okmij.org/ftp/continuations/against-callcc.html is pretty informative. It was kind of eye opening to see just how many corner cases there are when dealing with continuations.

(See the section “memory leaks”.)

Thanks for the link! Unfortunately I don't understand what it's saying the issue is... would you have a simple example to illustrate? It's been years since I did Scheme, I've never actually needed to use call/cc in a program, and I'm not advanced enough in Scheme to have seen shift/reset (as with call/c, their documentation is not quite clear). :\
I could, but not at 3 AM. :) I'll try to remember tomorrow.