isocpp / isocpp/CppCoreGuidelines

Should there be guildlines for bounding friendship?

Open
#1,303 7 comments 0 reactions 2 assignees View on GitHub

@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

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.