You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ perl6 -e 'role R { method r {...} }; class C does R { has R $.a handles <r> }'
===SORRY!=== Error while compiling -e
Method 'r' must be implemented by C because it is required by roles: R.
at -e:1
I was searching for the reason, and looks that the compose_attributes (that creates the handled methods) is called after the check of the roles' stubed methods.
Expected Behavior
That should work
Actual Behavior
breaks at compile time sayng that the method wasnt implemented
Steps to Reproduce
just run the one-liner
Environment
Operating system: ubuntu and mac os x
Compiler version (perl6 -v):
This is Rakudo version 2018.08 built on MoarVM version 2018.08
implementing Perl 6.c.
The text was updated successfully, but these errors were encountered:
It's a (I think solvable) ordering and factoring problem.
Attribute composition must happen after role composition for multiple reasons, so it's not a simple case of "re-order the steps". That means we have to break out the check for missing requirements - which I think happens inside the role composition code at the moment - so that it can happen after attribute composition. And then somehow communicate this between the phases. So, a bit less neat, but probably worth it, since folks stub their toe on this every now and then.
FCO
added a commit
to FCO/rakudo
that referenced
this issue
Oct 18, 2018
The Problem
I was searching for the reason, and looks that the compose_attributes (that creates the handled methods) is called after the check of the roles' stubed methods.
Expected Behavior
That should work
Actual Behavior
breaks at compile time sayng that the method wasnt implemented
Steps to Reproduce
just run the one-liner
Environment
perl6 -v):The text was updated successfully, but these errors were encountered: