C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Impose friendship when needed

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sun, 17 Jul 2022 20:49:45 -0400
On Sun, Jul 17, 2022 at 5:07 PM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On Sun, Jul 17, 2022 at 7:36 PM Robert A.H. Leahy wrote:
> >
> > Being able to "impose friendship" would create a maintenance nightmare for everyone who writes libraries.
>
>
> No, it wouldn't. A simple disclaimer:
>
> "The behaviour of this library is undefined if you impose friendship".

You could also not make anything private and put a comment over
members, saying "please do not modify these."

If you can backdoor a language feature so simply and so trivially...
what is the point of it at all? I mean, it's bad enough that any
serious reflection feature will make it possible to reflect past
access classes. But at least reflection is hard to write. We shouldn't
add a language feature to break private access with a single keyword.

Received on 2022-07-18 00:52:21