isocpp / isocpp/CppCoreGuidelines
C.131: Avoid trivial getters and setters - a request for clarification
@GabrielDosReis is already working on this.
Since Apr 9, 2018.
- Dominant language
- CSS
- Stars
- 45.3k
- Forks
- 5.6k
- PR merge metrics
- No merged PRs in 30d
Description
I realize that this is a controversial item and that there are already a few inconclusive discussions about it, but I hope that my question may have a clear answer.
Basically, I would like it clarified whether the intended reading of this guideline is
Avoid pairs of trivial getters and trivial setters
or
Avoid trivial getters and avoid trivial setters
and if it's the latter, why?
It seems to me that it is perfectly reasonable to have a trivial getter if the setter is non-trivial (or not present). This does not appear to contradict the reasoning in the item in any way. I'm even thinking that maybe the most direct way to communicate the intent would be
Avoid trivial setters
wouldn't it?
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.
Assessment
This issue has not been assessed yet.