Date: Mon, 11 Nov 2024 14:16:11 +0200
Ville Voutilainen wrote:
> On Mon, 11 Nov 2024 at 13:54, Peter Dimov <pdimov_at_[hidden]> wrote:
> >
> > Ville Voutilainen wrote:
> > > On Mon, 11 Nov 2024 at 13:30, Peter Dimov <pdimov_at_[hidden]>
> wrote:
> > > >
> > > > Ville Voutilainen wrote:
> > > > > Perhaps we should have reflection queries for such properties,
> > > > > instead of relying on access-bypassing reflection of privates.
> > > >
> > > > Seeing the entire class definition is not access. Access is access.
> > >
> > > I wonder whether you're talking about object access. Access controls
> > > in C++, however, cover more than that.
> > > You can't programmatically form well-formed dependencies to
> > > inaccessible parts of a class definition, including, for example, nested types
> that are private.
> >
> > No? https://godbolt.org/z/833hc99E4
>
> ..unless exposed by something accessible, sure. I trust I don't need to godbolt
> for you what happens with
>
> class X
> {
> class Nested{};
> };
>
> X::Nested xn;
Such trivial examples don't get us anywhere, because the same happens with
^^X::Nested.
Yes, you can iterate over the nested types, check whether identifier_of is
"Nested", get that reflection, and then cast away the access bits so that you
can splice it. I'd say that if you really invest all that effort, you deserve to have
the type. Murphy, not Machiavelli, right?
> On Mon, 11 Nov 2024 at 13:54, Peter Dimov <pdimov_at_[hidden]> wrote:
> >
> > Ville Voutilainen wrote:
> > > On Mon, 11 Nov 2024 at 13:30, Peter Dimov <pdimov_at_[hidden]>
> wrote:
> > > >
> > > > Ville Voutilainen wrote:
> > > > > Perhaps we should have reflection queries for such properties,
> > > > > instead of relying on access-bypassing reflection of privates.
> > > >
> > > > Seeing the entire class definition is not access. Access is access.
> > >
> > > I wonder whether you're talking about object access. Access controls
> > > in C++, however, cover more than that.
> > > You can't programmatically form well-formed dependencies to
> > > inaccessible parts of a class definition, including, for example, nested types
> that are private.
> >
> > No? https://godbolt.org/z/833hc99E4
>
> ..unless exposed by something accessible, sure. I trust I don't need to godbolt
> for you what happens with
>
> class X
> {
> class Nested{};
> };
>
> X::Nested xn;
Such trivial examples don't get us anywhere, because the same happens with
^^X::Nested.
Yes, you can iterate over the nested types, check whether identifier_of is
"Nested", get that reflection, and then cast away the access bits so that you
can splice it. I'd say that if you really invest all that effort, you deserve to have
the type. Murphy, not Machiavelli, right?
Received on 2024-11-11 12:16:16