On Sat May 25 22:32:15 2013, pmichaud wrote:
> On Sat May 25 21:13:26 2013, coke wrote:
> > 23:54 < [Coke]> r: for 1..10  { my $a = 3; FIRST { say $a} }
> > 23:54 <+camelia> rakudo 45ae2d: OUTPUT«(Any)␤»
> > 
> > I would expect that to output "3".
> > 
> 
> Since the FIRST block is invoked before the assignment/initialization, 
> the output of "Any" seems correct.
> 
> For example:
> 
>     > for 1..5 { my $a; FIRST { $a = 3 }; say $a }
>     3
>     (Any)
>     (Any)
>     (Any)
>     (Any)
>     > 
> 
> Thus the FIRST block sees the correct lexical $a... it's just executing 
> before the initialization.
> 
> Pm

Spec agress with you: "at loop initialization time, before any ENTER"

I expected it to mean "the FIRST time a block is executed".

My workaround was to use a lexical to track if it was the first time through 
the loop or not; 
will stick with that.

Sadly, Rejecting ticket.

-- 
Will "Coke" Coleda

Reply via email to