Skip Menu |
Report information
Id: 116465
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] Even parameterized roles should be punned to classes if inherited using 'is' in Rakudo
Date: Sun, 20 Jan 2013 14:06:18 -0800
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 1013b
<masak> r: role R[::T] {}; class B {}; class C does R[B] {}; say "alive" <p6eval> rakudo 35b2a9: OUTPUT«alive␤» <masak> r: role R[::T] {}; class B {}; class C is R[B] {} <p6eval> rakudo 35b2a9: OUTPUT«===SORRY!===␤Cannot call 'trait_mod:<is>'; none of these signatures match: [...] <masak> std: role R[::T] {}; class B {}; class C is R[B] {} <p6eval> std 7deb9d7: OUTPUT«ok 00:00 45m␤» <masak> I realize that Rakudo doesn't have much to work with here... <masak> (it's essentially the same situation as earlier, with trait_mod:<is> doing all the heavy lifting, and we shouldn't muck too much with that) <masak> ...but I had to realize all on my own that I had used 'is' where I shoulda used 'does'. <masak> jnthn: is that worth a rakudobug, or should I just write code correctly from the beginning? :P <jnthn> masak: um, I thought we should pun the role into a class and inherit from that. <jnthn> masak: So file a "prolly shunt fail at all" bug :) * masak files a "prolly shunt fail at all" rakudobug
Download (untitled) / with headers
text/plain 800b
On Sun Jan 20 14:06:41 2013, masak wrote: Show quoted text
> <masak> r: role R[::T] {}; class B {}; class C does R[B] {}; say "alive" > <p6eval> rakudo 35b2a9: OUTPUT«alive␤» > <masak> r: role R[::T] {}; class B {}; class C is R[B] {} > <p6eval> rakudo 35b2a9: OUTPUT«===SORRY!===␤Cannot call > 'trait_mod:<is>'; none of these signatures match: [...]
The problem is that Rakudo parses "C is R[B]" as trait_mod:<is>(C, R, [B]), rather than trait_mod:<is>(C, R[B]). Show quoted text
> <masak> std: role R[::T] {}; class B {}; class C is R[B] {} > <p6eval> std 7deb9d7: OUTPUT«ok 00:00 45m␤»
STD parses that the same way as Rakudo, but I don't think we should clone the action behavior of <typename> (which handles "does R[B]") inside the action method of trait_mod:is. I'm not sure what a solution is at this time. ~Mouq


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