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
return() in pointy blocks
by Ingo Blechschmidt other posts by this author
Jun 7 2005 9:28AM messages near this date
Re: return() in pointy blocks | Re: return() in pointy blocks
Hi, 
 
  sub foo (Code $code) { 
    my $return_to_caller = ->  $ret { return $ret }; 
 
    $code($return_to_caller); 
    return 23; 
  } 
 
  sub bar (Code $return) { $return(42) } 
 
  say foo &bar; # 42 or 23? 
 
I think it should output 42, as the return() in the pointy 
block $return_to_caller affects &foo, not the pointy block. 
To leave a pointy block, one would have to use leave(), right? 
 
 
--Ingo 
 
--  
Linux, the choice of a GNU | To understand recursion, you must first 
generation on a dual AMD   | understand recursion. 
Athlon!                    |  
Thread:
Ingo Blechschmidt
Matt Fowles
Luke Palmer
=22TSa_=28Thomas_Sandla=DF=29=22
=22TSa_=28Thomas_Sandla=DF=29=22
Larry Wall
"TSa (Thomas Sandlaß)"
Larry Wall
Matt Fowles

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