develooper Front page | perl.perl6.compiler | Postings from January 2012

[perl #78142] [BUG] Statement level bare blocks for if statements

From:
Will Coleda via RT
Date:
January 11, 2012 07:33
Subject:
[perl #78142] [BUG] Statement level bare blocks for if statements
Message ID:
rt-3.6.HEAD-14510-1326295985-964.78142-15-0@perl.org
On Wed Sep 29 21:14:01 2010, ash_gti wrote:
> The S04 section on Statement Level Bare Blocks says:
> 
> # Not an error: Equivalent to "if foo() -> $x { say $x }"
>     { say $^x } if foo();
> 
> 
> $ perl6
> 
> > { say $^x } if 1;
> _block141
> 
> > if 1 -> $x { say $x }
> 1

This now gives no output rather than the anonymous block's internal 
name:
10:31 < [Coke]> rakudo: { say $^x } if 1;
10:31 <+p6eval> rakudo 38165a:  ( no output )

This still works:
10:32 < [Coke]> rakudo: if 1 -> $x { say $x }
10:32 <+p6eval> rakudo 38165a: OUTPUT«1␤»


> Seems like this is not functioning correctly. for loops seem to work 
fine:
> 
> $ perl6
> > { say $^x } for 1..3;
> 1
> 2
> 3
> > for 1..3 { say $^x };
> 1
> 2
> 3
> 
> So, this might be if statement specific.
> 
> 
> --
> John Harrison


-- 
Will "Coke" Coleda



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About