Luke Palmer <[EMAIL PROTECTED]> writes:

> 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.

Having worked through the little and seasoned Schemers, I'm actually at the
point where I can happily think that 'return' is deep scary magic. What I
*want* is a 'proper' continuation, but this would have been close enough for
government work until the real ones came along.


> 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.

Doesn't that call code with the continuation of the caller of
call_with_current_continuation, when it *should* call &code with the
continuation of call_with_current_continuation?

Reply via email to