lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hallo,

On 8/21/07, David Given <dg@cowlark.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Mark Hamburg wrote:
> [...]
> > Really. Scheme will keep the dynamic chain around as long as the
> > continuation exists and you can return up the chain again. It's interesting
> > for implementing things like backtracking. Or think of it as setjmp/longjmp
> > taken to its logical conclusion.
>
> So let's consider my original example, where the closure is an event handler.
>
> Doesn't this mean that when the closure returns, it'll abandon the dynamic
> chain containing the event loop and replace it with a clone of the dynamic
> chain that called the setup code? Which means you end up with no event loop?
> Of course, for this situation to occur at all, then the returning setup code
> must eventually arrive at a call to the event loop, which means that the
> cloned dynamic chain will arrive at the same call, and... I think my head hurts!
>

     I don't know if I've understood your question very well, but in
Scheme no live chains are collected, so there is no "replacing". You
can even keep "moving" between all the chains, or "stacks". But for
this to happen, you have to capture the chains you want and store them
somewhere with call-with-current-continuation, aka call/cc.

> (Are there any Googleable terms where I can go and read up on this? I did try
> various keywords earlier, but the results were awfully fuzzy.)
>

"Scheme continuations", "call/cc", "call-with-current-continuation"

Cheers,
-- 
-alex
http://www.ventonegro.org/