Skip Menu |
Report information
Id: 81548
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

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



Subject: [BUG] Can't do 'handles' on a type in Rakudo
Date: Sat, 1 Jan 2011 19:33:37 +0100
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 610b
<masak> rakudo: class A { has @.b handles Array }; my $a = A.new; say $a.b.perl; $a.push(1, 2, 3); say $a.b.perl <p6eval> rakudo b570a2: OUTPUT«[]␤Method 'push' not found for invocant of class 'A'␤ in main program body at line 22:/tmp/KrHSBT37lh␤» <masak> aww. * masak submits rakudobug <masak> would have been really cool if that worked... <moritz_> what's the bug? <masak> S12:1366: "If you say C<has $.fur is rw handles Groomable;> then you get only those methods available via the C<Groomable> role or class." <moritz_> ah. <masak> by extension, I expected to get the methods available via Array.
RT-Send-CC: perl6-language [...] perl.org
Download (untitled) / with headers
text/plain 481b
FWIW 'has $!a handles TypeObject' is now implemented, and works fine for roles. It doesn't work for classes, because they have a .new method. So the standard .new is overridden, trying to call the .new on an attribute, but since there's no instance yet, the access to the attribute fails. That's a conceptual problem and needs a spec resolution. One possible approach would be to only install methods not yet present in $?CLASS or its superclassess.... any better ideas? Moritz


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