On 6/8/05, Piers Cawley <[EMAIL PROTECTED]> wrote:
> > In other words, it outputs:
> >
> >    Foo
> >    Foo
> >    # dies

Yep.  My mistake.

> If that works, then I think it means we can write:
> 
>     sub call-with-current-continuation(Code $code) {
>         my $cc = -> $retval { return $retval }
>         $code($cc);
>     }
> 
> Which I personally think is rather cute. Even if I can't quite bring myself to
> believe it's that simple...

Yeah, that's pretty.  But that will bite people who don't understand
continuations; it will bite people who don't understand "return"; it
will even bite people who understand continuations, because they can
be made in such an awkward form so easily.

Currently call/cc is done like this:

    sub call_with_current_continuation(&code) {
        &code(&?CALLER_CONTINUATION);
    }

But that might be broken in pugs at the moment.

Luke

Reply via email to