-
-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't override multi method from role #5047
Comments
This is totally correct behavior. A role is mixed into the class. Methods are added, roughly, as if you'd just add them at the end of the class declaration. It is not about roles being able to override anything. |
Then why does this work:
or this:
I find this all very inconsistent. |
No, it is consistent because in this example when method already exists on the class the one from role is ignored. That's why I used 'roughly' in the previous comment. It was only related to the case of
There is a case which confuses me. If the role has its own |
Just to make sure everyone's on the same page with the underlying structure:
Now on the issue at hand.
This isn't overriding anything; it's just suppressing the auto-generation of a
I'd lean towards the expectations of @Leont here and suggest we change the role composer such that the presence of an |
I'd still suggest that if a role defines own proto the candidates are to be put in that proto and if the class defines another one of the same name then role's proposal is dropped altogether. For two protos from two roles the conflict resolution is to be applied. The point is that a role developer might have different expectations while developing candidates and the expectations may not be fulfilled by class' More complicated behavior may involve signature comparison.
Makes sense, actually. I would try to look into if when time allows. |
Apparently it's not possible to override a multi method from a role with an only method:
It is however possible to override it with a proto method
This doesn't make sense and is not helpful. If I can do one I should be able to do the other.
Environment
The text was updated successfully, but these errors were encountered: