A section on the "Applying Roles" portion of the Objects page could be clarified
Nobody has claimed this yet.
- Dominant language
- Raku
- Stars
- 308
- Forks
- 288
- Avg merge
- 3d 49m
- Merged PRs (30d)
- 2
Description
The problem
There is a section in the "Applying Roles" topic on the Objects Page that discusses how to resolve a conflicting methods in Object composition that I feel could be clarified.
The proposed solution by the page is:
my class Taurus does Bull-Like does Steerable {
method steer($direction?) {
self.Steerable::steer($direction)
}
}
Which defeats the point of having role Bull-Like. A better solution would probably be:
class Taurus does Bull-Like does Steerable {
method steer ($direction?) {
if $direction {
self.Steerable::steer($direction);
} else {
self.Bull-Like::steer;
}
}
}
Which has the added advantage of showing the reader how to resolve a situation where two roles have the same method name, with a different signature.
Suggestions
If this makes sense, please let me know. I can then make the required changes and submit a PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the Objects page's "Applying Roles" section and review the explanation and code example for conflicting methods in object composition. Clarify the example so it explains how to resolve same-named methods from two roles with different signatures, then verify the revised documentation and examples are consistent.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100