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

Re: So, what the heck is a continuation anyway?



At 03:54 PM 12/10/2001 -0500, Matthias Felleisen wrote:

>   > X-Sender: dan@pop.sidhe.org
>   > Date: Mon, 10 Dec 2001 15:39:41 -0500
>   > From: Dan Sugalski <dan@sidhe.org>
>   > Content-Type: text/plain; charset="us-ascii"; format=flowed
>   > Sender: owner-ll1-discuss@ai.mit.edu
>   > Precedence: bulk
>   >
>   > At 03:11 PM 12/10/2001 -0500, Shriram Krishnamurthi wrote:
>   > >Dan, here's an explanation that should make sense to an assembly hacker:
>   > >
>   > >One simple way to think of a continuation is
>   > >
>   > >   It's the stack.
>   > >
>   >
>   > Is the copying fully required, and does anything that happens after the
>   > snapshot's taken affect the snapshot?
>   >
>   > For example, if I have:
>   >
>   >     {
>   >        int i = 0;
>   >        make_continuation();
>   >        print i;
>   >        i = 3;
>   >     }
>   >
>   > Will that print 0 or 3 when the continuation is invoked? And if I invoke
>   > that continuation a second time will it print 0 or 3?
>
>
>That's where Shriram's simple explanation breaks down. Suppose you had
>taken an EOPL-based course on interpreters (junior level). Then Shriram
>would have told you
>
>  the continuation is the closure representation
>  of the rest of the computation with a built-in
>  "abort"

Ah, that makes sense. That it does scares me a little, but that's beside 
the point.

>An answer to a question that you didn't ask:
>
>  do NOT (did you see the caps?) capture continuations with a function such
>  as make_continuation() -- been there, done that, bad idea.

It was like that mainly to be explicit. Your point is well-taken--I can 
feel the pain from here.

>P.S. BTW, you forgot the implicit invocation of your continuation. You
>really had three of them.

It was simple for the purposes of example. Too simple, but...

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk