Is method conflict of roles fatal? Is there the way to resolve? #76
Unanswered
yuki-kimoto
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Yes.
Unfortunately, we never had agreement on the syntax for method exclusion, aliasing, or renaming. Thus, it's not in the Corinna spec, even though, as you point out, it's a needed features. Instead, you'll need to do something like this: role Breakable {
method break () { ... }
}
role Breakdancer {
method break () { ... }
}
class NastyDancerHack :does(Breakable) {
...
}
class NastyDancerHack2 :does(Breakdancer) {
...
}
class FragileDancer {
field $nasty_hack { NastyDancerHack->new };
field $nasy_hack2 { NastyDancerHack2->new };
# Internallly delegate to those feilds as needed
} No, I don't like the above, either. Until such time that we have a clean syntax for this, we're stuck. If you have suggestions for a such a syntax, I'd love to hear them :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is method conflict of roles fatal?
https://github.com/Ovid/Cor/blob/master/rfc/roles.md#83-example
A fatal example:
This is maybe fatal. I want to know the way to resolve these.
Resolution of Moose
Is Moose resolution way used in Corinna?
https://metacpan.org/dist/Moose/view/lib/Moose/Manual/Roles.pod#METHOD-CONFLICTS
I rewrite the code using Corinna
Beta Was this translation helpful? Give feedback.
All reactions