develooper Front page | perl.perl6.language | Postings from July 2002

Re: Continuations for fun and profit

Thread Previous
From:
David M. Lloyd
Date:
July 8, 2002 14:16
Subject:
Re: Continuations for fun and profit
Message ID:
Pine.LNX.4.44.0207081613440.27705-100000@tomservo.workpc.tds.net
On Mon, 8 Jul 2002, 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),

I think starting at the next statement would be cooler in some ways:

  $cont = take_continuation() and start_async_op($cont) and return;

  # do other stuff with results of async_op

- D

<dmlloyd@tds.net>


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About