You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<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 23Null 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«beforeNull PMC access in
get_attr_str() in 'A::foo' [...]
* masak submits rakudobug
Migrated from rt.perl.org#81718 (status was 'resolved')
Searchable as RT81718$
The text was updated successfully, but these errors were encountered: