On Sun, 03 Mar 2013 10:47:32 -0800, FROGGS.de wrote:
> There are weird things goind on:
> 
> good:
> <FROGGS> r: '' ~~ / :my $a; <{ '$a' }> /
> <p6eval> rakudo 123dfa:  ( no output )
> 
> good:
> <FROGGS> r: say '' ~~ / :my $a; <{ '$a' }> /
> <p6eval> rakudo 123dfa: OUTPUT«#<failed match>␤»
> 
> weird:
> <FROGGS> r: say '123' ~~ / :my $a=2; <{ '$a' }> /
> <p6eval> rakudo 123dfa: OUTPUT«「1」␤␤»
> 
> good:
> <FROGGS> r: say '123' ~~ / :my $a=2; <{ "$a" }> /
> <p6eval> rakudo 123dfa: OUTPUT«「2」␤␤»
> 
> weird:
> <FROGGS> r: say '$a' ~~ / :my $a=2; <{ '$a' }> /
> <p6eval> rakudo 123dfa: OUTPUT«#<failed match>␤»
> 
> good:
> <FROGGS> std: say '$a' ~~ / <{ '$a' }> /
> <p6eval> std 52fe6d2: OUTPUT«ok 00:00 43m␤»
> 
> IMO only variables in double quotes should interpolate. so '$a' should
> be treatet as that string.

As per the other reply, first { '$a' } produces the string $a,
then that string is interpreted as a regex which contains a
variable lookup, and the lexical lookup for $a is expected too work,
so the second "weird" example is functioning as intended.

Tests, including making sure $a is not expanded before the
closure returns, were added in roast commit 1bbe3c9d3, so resolving this ticket.

Reply via email to