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 doing //= on an undefined attribute and then calling it in Rakudo #2835

Closed
p6rt opened this issue Jul 21, 2012 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Jul 21, 2012

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

Searchable as RT114230$

@p6rt
Copy link
Author

p6rt commented Jul 21, 2012

From @masak

<masak> oh, but hm.
<masak> r​: class C { has &!x; method f { say defined &!x; &!x //= {
'ook!' }; say defined &!x; &!x() } }; C.new.f
<p6eval> rakudo 5b56cf​: OUTPUT«False␤True␤Null PMC access in
get_pmc_keyed_str() [...]
* masak submits rakudobug
<masak> r​: sub foo(&x?) { &x //= { say "OH HAI" }; &x() }; foo
<p6eval> rakudo 5b56cf​: OUTPUT«invoke() not implemented in class
'Callable' [...]
<jnthn> ah, no private attr needed.
<masak> yeah, but only the private attr gives a Null PMC access so far.
<jnthn> r​: sub foo(&x?) { say defined &x; say
nqp​::p6box_i(nqp​::defined(&x)) }; foo
<p6eval> rakudo 5b56cf​: OUTPUT«False␤1␤»
<jnthn> Well. That goes some way to explaining things.
<masak> r​: class C { has &!x; method f { &!x() } }; C.new.f
<p6eval> rakudo 5b56cf​: OUTPUT«No such method 'Any' for invocant of
type 'Parcel' [...]
<jnthn> Ohhhh...
<jnthn> It sees an invocation of a type object and thinks "oh, it's a coercin"
<jnthn> Since Any(...) is how you coerce.

@p6rt
Copy link
Author

p6rt commented Oct 22, 2014

From @usev6

The Null PMC access no longer occurs. On Moar, Parrot and JVM this now runs fine (and has identical output)​:

$ perl6 -e 'class C { has &!x; method f { say defined &!x; &!x //= {"ook!" }; say defined &!x; &!x() } }; C.new.f'
False
True

I added a test to S12-attributes/class.t with the following commit​: Raku/roast@1345d8bf7a

I'm closing this ticket now.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 22, 2014

From @usev6

The Null PMC access no longer occurs. On Moar, Parrot and JVM this now runs fine (and has identical output)​:

$ perl6 -e 'class C { has &!x; method f { say defined &!x; &!x //= {"ook!" }; say defined &!x; &!x() } }; C.new.f'
False
True

I added a test to S12-attributes/class.t with the following commit​: Raku/roast@1345d8bf7a

I'm closing this ticket now.

@p6rt p6rt closed this as completed Oct 22, 2014
@p6rt
Copy link
Author

p6rt commented Oct 22, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant