On Mon, Jul 08, 2002 at 04:54:16PM -0400, Dan Sugalski wrote:
> Pretty simple. (For illustrative purposes) To do that with
> continuations, it'd look like:
>
> $cont = take_continuation();
> if ($foo) {
> $foo--;
> invoke($cont);
> }
>
> take_continuation() returns a continuation for the current point (or
> it could return one for the start of the next statement--either
> works), and invoke takes a continuation and invokes it. When you
> invoke a continuation you put the call scratchpads and lexical
> scratchpads back to the state they were when you took the
> continuation.
So take_continuation is called once and returns 1 or more times?
(1st return is just after you called it, second and later are for each time
you invoke $cont from somewhere else)
and invoke is goto-on-steroids, and never returns? (except if $cont is duff,
somewhat like the exec system call in Unix only returns on failure)
And everything else is serene and swan-like?
(ie the language gives the appearance of moving smoothly on the surface,
but under water its feet are paddling furiously to implement motion)
Nicholas Clark
--
Even better than the real thing: http://nms-cgi.sourceforge.net/