isocpp / isocpp/CppCoreGuidelines

C.131: Avoid trivial getters and setters - a request for clarification

Open
#1,178 1 comment 1 reaction 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.