isocpp / isocpp/CppCoreGuidelines
Should there be guildlines for bounding friendship?
@BjarneStroustrup is already working on this.
Since Jan 3, 2019.
- Dominant language
- CSS
- Stars
- 45.3k
- Forks
- 5.6k
- PR merge metrics
- No merged PRs in 30d
Description
Except for very simple classes, C++ friendship should be more like human friendship. The secrets we divulge to each non-stranger is distinct to that particular non-stranger. We generally don't want anyone to know all of our secrets. Could there be guidelines for capturing statically-checkable limits to friendship in code? Maybe following the pattern illustrated by this example: https://godbolt.org/z/Ztw-SQ
The caveat is that bounding friendship could be a crutch that enables overly complex classes. Programmers have a tendency to not break up large classes when they should. It's a partial backslide into the "it's easier if everything's global" philosophy.
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.