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


<szabgab> rakudo: class X { has $.y is rw; sub qq() { say "sub $.y" };
method rr() { say "method $.y"; qq() } }; my $z = X.new; $z.y = 23;
$z.rr()
<p6eval> rakudo 244d0f: OUTPUT«method 23␤Null PMC access in
find_method('y')␤  in 'X::qq' [...]
<szabgab> so sub() in a class does not know about the attributes of the class?
<sorear> szabgab: subs don't have an invocant parameter
<szabgab> what is an "invocant parameter"?
<masak> szabgab: subs "belong to the class". attributes are declared
in the class but "belong to the object". therefore, the sub can't see
the attributes.
<masak> rakudo: class A { has $!x; sub foo { say "before"; say $!x;
say "after" }; method bar { foo } }; A.new.bar
<p6eval> rakudo 244d0f: OUTPUT«before␤Null PMC access in
get_attr_str()␤  in 'A::foo' [...]
* masak submits rakudobug

Reply via email to