Hi,

I believe that this is valid:

my $thingy = -> $x { say $x };

However, looking through STD.pm the only time we parse for a pblock is in statement control. So either I'm missing something, or STD.pm is. :-)

I tried using pblock in place of block in circumfix. I think this may work. However, it doesn't work out so well in Rakudo, because we are running actions based upon pblock itself rather than leaving actions of rules that mention pblock to do the work, as STD.pm says needs to be done. Just as the grammar STD.pm suggests, the problems show up with if blocks.

Anyways, I'm too tired to refactor that tonight...

And while I'm rambling about this kinda stuff, I discovered this because I was actually looking at cases where we pass blocks off to things like grep.

my @b = @a.grep: { $_ > 42 };

I'm thinking that $_ is really a parameter to this block, so in grep you'd do "if $condition($elem) { ... }" to invoke the conditional block. However, I guess we'd better make it an optional parameter, otherwise you can't write stuff like:

sub pointless($call) {
   $call();
}
pointless { say "foo" };

Thanks,

Jonathan

Reply via email to