Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null PMC access when attribute is accessed from a sub in a class in Rakudo #2322

Closed
p6rt opened this issue Jan 6, 2011 · 3 comments
Closed
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 6, 2011

Migrated from rt.perl.org#81718 (status was 'resolved')

Searchable as RT81718$

@p6rt
Copy link
Author

p6rt commented Jan 6, 2011

From @masak

<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

@p6rt
Copy link
Author

p6rt commented Feb 10, 2012

From @moritz

Now says

Variable $.y used where no 'self' available at line 1

which is as awesome as it gets.

Test in t/spec/S12-class/attributes.t passes.

@p6rt
Copy link
Author

p6rt commented Feb 10, 2012

@moritz - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Feb 10, 2012
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant