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

Cannot bind to role attribute from a class #5772

Open
p6rt opened this issue Nov 6, 2016 · 1 comment
Open

Cannot bind to role attribute from a class #5772

p6rt opened this issue Nov 6, 2016 · 1 comment

Comments

@p6rt
Copy link

p6rt commented Nov 6, 2016

Migrated from rt.perl.org#130030 (status was 'new')

Searchable as RT130030$

@p6rt
Copy link
Author

p6rt commented Nov 6, 2016

From @lizmat

<lizmat> m​: role A { has $!foo }; class B does A { method b() { $!foo := 42 } }; B.b # shouldn't this just work ?
<camelia> rakudo-moar 8b40d1​: OUTPUT«X​::TypeCheck​::Binding exception produced no message␤ in method b at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
<lizmat> jnthn ^^^
<timotimo> m​: role A { has $!foo }; class B does A { method b() { $!foo := 42 } }; B.new.b
<camelia> rakudo-moar 8b40d1​: OUTPUT«X​::TypeCheck​::Binding exception produced no message␤ in method b at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
<timotimo> m​: role A { has $!foo }; class B does A { method b() { $!foo = 42 } }; B.new.b
<camelia> rakudo-moar 8b40d1​: ( no output )
<lizmat> yeah, I missed the .new in my example, but the result is the same, no?
<lizmat> binding just doesn't work
<timotimo> right
<timotimo> are assignments to native attributes already just nqp​::bindattr?
<timotimo> er, not "native"
<timotimo> but that kind of makes it awkward to put Scalar objects into attributes and assigning binds the new value to replace the scalar instead of assigning into the scalar?
<timotimo> except if you use accessors, you potentially get an AttrRef that's scalar-like? perhaps?
<lizmat> what I want to achieve is to bind an nqp​::list from a '$!reified' slot
<lizmat> if I just assign, I get this​:
<lizmat> $ 6l 'my @​a[10] = ^10; say @​a.iterator.pull-one'
<lizmat> Segmentation fault​: 11
<lizmat> :-(
<lizmat> ok, I guess I'll work around it :-(
<lizmat> timotimo​: do you agree this is buggable ?
<timotimo> huh, ouch
<nine> lizmat​: all segfaults are buggable
<timotimo> quite

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

No branches or pull requests

1 participant