Skip Menu |
Report information
Id: 130030
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: elizabeth <liz [at] dijkmat.nl>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug [...] perl.org
Date: Sun, 6 Nov 2016 14:41:07 +0100
Subject: Cannot bind to role attribute from a class
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
Download (untitled) / with headers
text/plain 1.5k
<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


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org