# New Ticket Created by  Paweł Pabian 
# Please include the string:  [perl #115186]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=115186 >


 <bbkr_> rakudo: try { CATCH { }; die; }; say "alive"
 <p6eval> rakudo 870d18: OUTPUT«␤  in block  at /tmp/SogYHm1UM4:1␤␤»

It enters CATCH block correctly. But it does not behave correctly according to
http://perlcabal.org/syn/S04.html#Statement-ending_blocks

"In the absence of explicit control flow terminating the block early, the 
return value of a block is the value of its final statement.
(…) If there are no statements in the block at all, the result is also Nil."

CATCH block seems to work only with explicit return:

$ perl6 -e 'try { CATCH { return 1; }; die; }; say "alive"'
alive

Lack of explicit return causes exception to "leak" into upper scope:

$ perl6 -e 'try { try { CATCH { 1; }; die; }; CATCH { .WHAT.say }}'
X::AdHoc()

Tested on Rakudo Star 2012.09.

Reply via email to