[perl #122892] [BUG] Scoping issue with regex using attribute in method in Rakudo

2014-10-03 Thread Carl Mäsak
# New Ticket Created by  Carl Mäsak 
# Please include the string:  [perl #122892]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=122892 


TuxCM http://pastebin.com/PpDKvrd9 = I do not understand
Ven pmurias: right -- I agree with that! I was just wondering why
angular of all the template systems
moritz TuxCM: seems to be a scoping bug of sorts
masak m: my $sep = |; class C { method foo { .say for
foo|bar.split(/$sep/).map(~*) } }; C.new.foo
masak m: class C { has $.sep = |; method foo { .say for
foo|bar.split(/$!sep/).map(~*) } }; C.new.foo
camelia rakudo-moar da3aae: OUTPUT«foo|bar␤»
masak TuxCM: interesting.
* masak submits rakudobug


Re: [perl #122892] [BUG] Scoping issue with regex using attribute in method in Rakudo

2014-10-03 Thread Patrick R. Michaud
On Fri, Oct 03, 2014 at 06:48:50AM -0700, Carl Mäsak wrote:
 masak m: class C { has $.sep = |; method foo { .say for
 foo|bar.split(/$!sep/).map(~*) } }; C.new.foo
 camelia rakudo-moar da3aae: OUTPUT«foo|bar␤»
 masak TuxCM: interesting.
 * masak submits rakudobug

14:09 pmichaud m: class C { has $.rx = 'bc';  method foo { say 'abcd' ~~ 
/$!rx/; } };  C.new.foo
14:09 camelia rakudo-moar da3aae: OUTPUT«Nil␤»
14:10 pmichaud I'm guessing that regexes don't know how to interpolate $!vars
14:10 pmichaud m: class C { has $.rx = 'bc';  method foo { say $!rx; say 
'abcd' ~~ /$!rx/; } };  C.new.foo
14:10 camelia rakudo-moar da3aae: OUTPUT«bc␤Nil␤»
14:11 moritz or maybe the attribute lookup gets the cursor object as invocant?

Pm