# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #72326]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=72326 >


This be Rakudo db84bc on Parrot r43174.

$ perl6 -e 'class A::B { my $c; method foo { $c = "OH HAI"; say $c }
}; A::B.foo'
OH HAI

$ perl6 -e 'class A::B { my $c; method foo { $A::B::c = "OH HAI"; say
$A::B::c } }; A::B.foo'
OH HAI

Fair enough. So far Rakudo agrees with my expectations. But watch this:

$ perl6 -e 'class A::B { my $c = 42; method foo { $A::B::c = "OH HAI";
say $c } }; A::B.foo'
42

$ perl6 -e 'class A::B { my $c = 42; method foo { $c = "OH HAI"; say
$A::B::c } }; A::B.foo'
Use of uninitialized value

Ok, so in the first case we set $A::B::c and $c is unaffected. I'd
expect it to change, since it's really the same memory
location/slot/whatever.

In the second case, we set $c and $A::B::c is unaffected. Furthermore,
$A::B::c isn't even initialized to 42 in this case, even though
$A::B::c should only be a longer way of saying $c (inside the A::B
scope).

Reply via email to