"Miko O'Sullivan" <[EMAIL PROTECTED]> writes: > From: "Damian Conway" <[EMAIL PROTECTED]> >> while (my $res = $search->getnext) { ...} >> >> has a valid meaning in Perl 6. In fact, it's meaning in Perl 6 is far more >> reasonable than in Perl 5. > > I don't think the new meaning makes sense at all. Essentially it's saying > "the statement gets run many times but the variable only gets declared > once". It makes sense to declare a variable many times when it gets a > fresh, new block for each declaration, like when it's inside a loop, but to > use it in a statement that is run many times but declares the var only once > seems like it ought to throw a warning about declaring the same variable in > the same scope multiple times.
Yeah, but declaration happens at compile time, not runtime so there's no problem. Minor syntax quibble, it should in fact be: while (my $res = $search.getnext) { ... } Or, for shiny collection modification fun: while (my $res := $search.getnext) { ... } -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?