C++ Logo

sg7

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 11 Nov 2024 10:29:35 +0200
On Mon, 11 Nov 2024 at 10:01, Oliver Hunt <oliver_at_[hidden]> wrote:

> An alternative would be to just provide public members my default while providing a non-default path that exposes all fields and members for the use cases that need it.

We already have this, in the form of
"added the get_public family of functions"
in P2996R7.

Of course, with various values of what you think is the default. But
the important bit is that those are distinguishable without complex
regexps
or requiring separate tooling like clang-query to find out which is
used in your codebase.

>So discouraging blind access to non-public members, without requiring separate tooling that renders the protection irrelevant anyway, but also negates any reason for those projects to consider reflection at all (specifically: if reflection cannot, by design, do what they need today there is no reason to even toy with adopting it. If they’re able to use reflection in a non-default path, then they can adopt the reflection mechanisms, and then migrate to a better overall design over time)

Sure, that sounds like a highly palatable approach. And I am not
asking for anything that conflicts with it.

Received on 2024-11-11 08:29:48