develooper Front page | perl.perl6.language | Postings from June 2005

return() in pointy blocks

Thread Next
Ingo Blechschmidt
June 7, 2005 09:28
return() in pointy blocks
Message ID:
  sub foo (Code $code) { 
    my $return_to_caller = -> $ret { return $ret }; 
    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? 
Linux, the choice of a GNU | To understand recursion, you must first 
generation on a dual AMD   | understand recursion. 
Athlon!                    |  

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About