C++ Logo

sg7

Advanced search

Re: [isocpp-sg7] SG7 late paper P3493R0 - Ruminations on reflection and access

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 11 Nov 2024 13:52:19 +0200
On Mon, 11 Nov 2024 at 13:23, Peter Dimov via SG7 <sg7_at_[hidden]> wrote:

> I however do not know of any scenario in which a program would need to
> do something with the set of accessible members. So having a way to
> obtain that set doesn't seem useful to me.

I do know of such cases. The generation of a qt_metacall implementation for
a QObject-derivative class annotated with a Q_OBJECT macro works like that.

You should perhaps consider the various use cases that have no need to
do something
with members that are inaccessible. When such use cases are written in terms of
member queries that do not return inaccessible members, it's then categorically
known that they perform no operations that bypass access. Which then
means that they
need no extra scrutiny to review that they do not break inaccessible
invariants of things that protect
invariants via access controls.

Received on 2024-11-11 11:52:33