Closed Xliff closed 5 years ago
Will try to look at this over the weekend.
Looks like this problem only exists when doing an is also
trait on a proto
in a role
. Looking into this further.
I'm not sure whether this is a problem in Rakudo's MOP, or that Method::Also
is abusing the MOP in such a way that this doesn't work. Anyways, what I found so far:
This last thing is causing the issue. I'm not sure how this can be made to work, because by the looks of this, when we add a proto
in the role definition, it works. But if we add the proto
using the MOP, it doesn't. Not sure whether it's incorrect invocation of the MOP, or that it is really a problem in the MOP itself. I'm not fully grokking the MOP in that respect, so this may require more research.
Could Method::Also
wait for class composition in the case of a Metamodel::ParametricRoleHOW?
@lizmat: Here's a working solution!
Thanks for that. But it feels to me we're working around a deficiency in role composition? And that the proper place to fix it would be there?
Sure!
Should I put this up as a bug for rakudo?
Please do. And perhaps see what needs to be changed in the role composition to Method::Also
work as is? And make a PR for that? That would be brill!
Sure thing!
Actually, with a few minor changes, I think that snippet would work just fine. I will set it up as a PR for your review.
See the following code:
Output:
Compare that behavior to the one when using a pure Class:
Output:
perl6 --version:
Just for kicks, I tried to bisect this on IRC. The results are here:
https://gist.github.com/Whateverable/6ad41ee17e9251bd8ea61f3f7674e004
It looks like this has been an issue since the 2015 release in one way or another.