ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Re: return() in pointy blocks
by Luke Palmer other posts by this author
Jun 8 2005 3:51PM messages near this date
Re: return() in pointy blocks | Re: return() in pointy blocks
On 6/8/05, Piers Cawley <pdcawley@[...].uk>  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
Thread:
Piers Cawley
Luke Palmer
Larry Wall
=22TSa_=28Thomas_Sandla=DF=29=22

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved