Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P2996 R7 Reflection for C++26 #1668

Open
wg21bot opened this issue Oct 16, 2023 · 39 comments
Open

P2996 R7 Reflection for C++26 #1668

wg21bot opened this issue Oct 16, 2023 · 39 comments
Assignees
Labels
C++26 Targeted at C++26 CWG Core IS Ship vehicle: IS LWG Library lwg-fullreview Paper is ready for lwg full group review needs-revision Paper needs changes before it can proceed reflection size - large paper size estimate
Milestone

Comments

@wg21bot
Copy link
Collaborator

wg21bot commented Oct 16, 2023

P2996R0 Reflection for C++26 (Wyatt Childers, Peter Dimov, Barry Revzin, Andrew Sutton, Faisal Vali, Daveed Vandevoorde)

@wg21bot wg21bot added the EWG Evolution label Oct 16, 2023
@wg21bot wg21bot added this to the 2023-telecon milestone Oct 16, 2023
@cor3ntin cor3ntin added SG7 Reflection reflection labels Oct 16, 2023
@jfbastien jfbastien removed the EWG Evolution label Oct 21, 2023
@hanickadot
Copy link
Collaborator

hanickadot commented Nov 11, 2023

SG7 polls at Kona 2023 meeting:

  1. We want to block the adoption of P2996R1 for C++26 on waiting for a design that has multiple types of handlers based on reflected entities in addition to having just opaque std::meta::info?

SF/F/N/A/SA
0/0/1/5/27
Consensus against.

  1. We want to make sure that in the future operator^ can change resulting types (in future C++ past 26)?

SF/F/N/A/SA
6/15/9/2/3
Consensus. (Not very strong)

  1. Forward P2996R1 to EWG and LEWG?

SF/F/N/A/SA
24/6/3/0/0
Unanimous consensus.

Forwarding to EWG.

@hanickadot hanickadot added EWG Evolution and removed SG7 Reflection labels Nov 11, 2023
@JohelEGP

This comment was marked as resolved.

@wg21bot
Copy link
Collaborator Author

wg21bot commented Dec 19, 2023

P2996R1 Reflection for C++26 (Wyatt Childers, Peter Dimov, Barry Revzin, Andrew Sutton, Faisal Vali, Daveed Vandevoorde)

@wg21bot wg21bot modified the milestones: 2023-telecon, 2024-telecon Dec 19, 2023
@wg21bot wg21bot changed the title P2996 R0 Reflection for C++26 P2996 R1 Reflection for C++26 Dec 19, 2023
@wg21bot
Copy link
Collaborator Author

wg21bot commented Feb 16, 2024

P2996R2 Reflection for C++26 (Wyatt Childers, Peter Dimov, Dan Katz, Barry Revzin, Andrew Sutton, Faisal Vali, Daveed Vandevoorde)

@wg21bot wg21bot changed the title P2996 R1 Reflection for C++26 P2996 R2 Reflection for C++26 Feb 16, 2024
@jfbastien jfbastien added the LEWG Library Evolution label Mar 8, 2024
@hanickadot

This comment was marked as outdated.

@inbal2l inbal2l added C++26 Targeted at C++26 size - large paper size estimate ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review IS Ship vehicle: IS labels Mar 8, 2024
@jfbastien jfbastien added the SG16 Text processing label Mar 19, 2024
@jfbastien
Copy link
Collaborator

From today's joint EWG / LEWG discussion in Tokyo, SG16 needs to provide feedback on the papers because strings can be used to represent source code names and Unicode is tricky. @tahonermann I've tagged SG16 for this.

@tahonermann
Copy link
Collaborator

Thank you @jfbastien, I'll get a discussion scheduled. Related paper: P1953 (Unicode Identifiers And Reflection) tracked by #690.

@erichkeane erichkeane added the SG15 Tooling label Mar 19, 2024
@wg21bot wg21bot changed the title P2996 R4 Reflection for C++26 P2996 R5 Reflection for C++26 Aug 15, 2024
@FabioFracassi
Copy link
Collaborator

FabioFracassi commented Aug 20, 2024

2024-08-20 Library Evolution Telecon

P2996R5: Reflection for C++26

2024-08-20 Library Evolution Telecon Minutes

Champion: Dan Katz
Chair: Fabio Fracassi
Minute Taker: Daveed Vandevoorde

Summary

We approved the following functions as is:

  1. consteval auto is_template(info r) -> bool
  2. consteval auto template_of(info r) -> info
  3. consteval auto template_arguments_of(info r) -> vector<info>
  4. consteval auto dealias(info r) -> info
  5. consteval auto can_substitute(info r, R&& args) -> bool
  6. consteval auto is_enumerator(info r) -> bool
  7. consteval auto is_constructor(info r) -> bool
  8. consteval auto is_default_constructor(info r) -> bool
  9. consteval auto is_copy_constructor(info r) -> bool
  10. consteval auto is_move_constructor(info r) -> bool
  11. consteval auto is_assignment(info r) -> bool
  12. consteval auto is_copy_assignment(info r) -> bool
  13. consteval auto is_move_assignment(info r) -> bool
  14. consteval auto is_destructor(info r) -> bool

We also approved the following function with modification:

  1. consteval auto reflect_value(T expr) -> info
  2. consteval auto reflect_object(T& expr) -> info
  3. consteval auto reflect_function(T& expr) -> info

Change: the requirement on T should be a "Mandate" instead of "Constant When"

  1. consteval auto is_special_member(info r) -> bool (changed into: consteval auto is_special_member_function(info r) -> bool)

Next Steps

Authors to apply the following changes:

  1. Rename is_special_member to is_special_member_function .
  2. Clarify the special member wording wrt template member functions.

For future reviews:

  1. Consider whether only elegible member functions should be exposed in template specialization when reviewing "members_of" function set (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2996r5.html#meta.reflection.member.queries-reflection-member-queries)
  2. Considering the decision in the previous section, consider adding is_elegible to query the eligibility of an overload (assuming exposed).

We will continue review on meta.reflection.queries section (note there have been some reordering of functions)

@inbal2l
Copy link
Collaborator

inbal2l commented Sep 24, 2024

2024-08-14 SG16 Telecon

P2996R5: Reflection for C++26

2024-08-14 SG16 Telecon Minutes

Champion: Dan Katz
Chair: Tom Honermann
Minute Taker: Tom Honermann

Summary

  • Earlier revisions had name_of() and qualified_name_of() functions have been removed due to complexity (spaces, representation of NTTP, etc.)

  • Instead, added:

    • consteval string_view identifier_of(info r);
    • consteval string_view u8identifier_of(info r);
    • consteval bool has_identifier(info r);
    • consteval string_view display_string_of(info r);
    • consteval string_view u8display_string_of(info r);
  • In addition, added predicates like :

    • is_operator_function()
    • is_conversion_function_template()
    • other accessors like operator_of().

Polls

POLL: Provide a generic: define_static_array(span<const T>) -> span<const T> function and remove define_static_string() until we have clarity on how to satisfy desires for a null terminated string and a return type of string_view (or similar).

SF F N A SA
6 2 1 0 0

Attendance: 10 (1 abstention)
Authors': N
Oucome: Strong consensus in favor

POLL: Forward P2996R5 with a recommendation to amend per prior poll to replace define_static_string with a generic define_static_array function.

SF F N A SA
7 3 0 0 0

Attendance: 10
Authors': F
Oucome: Strong consensus in favor

Next Step

SG16 approved asked to remove define_static_string and add define_static_array as specified in the poll, then forward the updated revision (P2996R6) to LEWG.
(@tahonermann - please update as you see fit)

@inbal2l
Copy link
Collaborator

inbal2l commented Sep 30, 2024

2024-09-24 Library Evolution Telecon

P2996R5: Reflection for C++26

2024-09-24 Library Evolution Telecon Minutes

Champion: Dan Katz
Chair: Inbal Levi
Minute Taker: Daveed Vandevoorde

Summary

The discussion was focused on [meta.reflection.member.queries] section and the [meta.reflection.member.access] section (including access_context class).

Polls:

POLL: Modify access_context and add:
static consteval access_context::global() noexcept;

SF F N A SA
9 5 2 1 0

Attendance: 20
Authors' position: SFx2 Fx2
Outcome: Consensus in favor

POLL: For access_context default ctor (Please vote for all the options that make sense (acceptable) to you):

  1. Remove it
  2. Ill-formed member_of_* when used with default CTOR access_context
  3. Empty access_context (returning empty vector of members)
  4. Call current access_context
  5. Call global access_context (as in the paper)
Option Votes
1 14
2 1
3 1
4 0
5 9

Outcome: Options 1 and option 5 (5 is what’s in the paper) got the strongest support .

IL: We will take a 5-way poll on the option moving away from what’s in the paper.
(assuming access_context::global() has been added).

POLL: Remove access_context’s default constructor.

SF F N A SA
6 6 3 1 0

Attendance: 21
Authors' position: A, F, SFx2
Outcome: consensus in favor

POLL: Rename "accessible_members_of" into "nameable_members_of".

SF F N A SA
3 1 5 3 0

Attendance: 15
Authors' position: SF, 2xN, A
Outcome: No consensus for a change

POLL: We are happy with the current behavior of "members_of" returning the maximum set of entities.

SF F N A SA
9 1 1 2 1

Attendance: 15
Authors: SFx4
Outcome: Consensus in favor

POLL: Approve “members_of” function as in P2996R5.

Attendance: 15
Outcome: No objection to unanimous consent.

POLL: We would like “members_of” to apply declaration order and approve the wording.

SF F N A SA
9 5 1 0 0

Attendance: 15
Authors: SFx4
Outcome: Strong consensus in favor

ACTION: Note that the last poll might create overhead, we ask for additional exploration on the performance penalty and confirmation from compiler implementors that this is doable.

We approved with the additional requirements:

  1. access_context (remove default constructor, add static consteval access_context::global() noexcept;, class later removed by authors)
  2. consteval vector<info> members_of(info r); (with members ordering, please explore overhead)
  3. consteval vector<info> accessible_members_of(info target, access_context from = access_context::current()); (renamed into nameable_members_of, pending further exploration on accessibility by context, function set later removed by authors)

Next Steps

Authors to apply the following changes:

  1. accessible_ functions require more investigation, especially in the context of modules and namespaces.
  2. Add an example/note for the behavior of members_of when applied to modules.
  3. members_of function got approved (with addition of declaration order, pending exploration).

For future reviews:

  1. Consider whether only elegible member functions should be exposed in template specialization when reviewing "members_of" function set [meta.reflection.queries]
  2. Considering the decision in the previous section, consider adding is_elegible to query the eligibility of an overload (assuming exposed).

NOTE: As a followup to the meeting, and due to controversy regarding the access_* set of functions, there were additional considerations sent in the reflector:

  • Reflector thread: "A rumination paper explaining the concerns about the 'default' access in reflection" (discussion)
  • As a result, authors decided to withdraw the set of access_ functions from the first delivery of "reflection", and add a set of get_public_* functions (resolution)

This resolution was supported in the reflector and will be published on P2996R7.

We will continue review on [meta.reflection.queries], [meta.reflection.result] and [meta.reflection.trans.other] sections.

@inbal2l
Copy link
Collaborator

inbal2l commented Oct 3, 2024

2024-10-01 Library Evolution Telecon

D2996R7: Reflection for C++26

2024-10-01 Library Evolution Telecon Minutes

Champion: Dan Katz
Chair: Inbal Levi, Fabio Fracassi
Minute Taker: Guy Davidson, Daveed Vandevoorde

Summary

We finalized the review on [meta.reflection.queries] (aside from: is_alias(info r), has_internal_linkage(info r), has_module_linkage(info r), has_external_linkage(info r), has_linkage(info r), which require core’s input), [meta.reflection.extract] and [meta.reflection.member.queries].

Summary

We approved the following functions as is:

  1. consteval bool has_complete_definition(info r); (discussed alongside with enumerators_of)
  2. consteval bool is_final(info type);
  3. consteval bool is_user_provided(info r); (with the removal of “Constant when” condition)
  4. consteval source_location source-location_of(info r);
  5. consteval info type_of(info r);
  6. consteval info object_of(info r);
  7. consteval info value_of(info r);
  8. consteval info parent_of(info r);
  9. template consteval T extract(info r);

We approved with the additional requirement of members ordering:

  1. consteval vector bases_of(info type);
  2. consteval vector static_data_members_of(info type);
  3. consteval vector nonstatic_data_members_of(info type);
  4. consteval vector get_public_members(info type);
  5. consteval vector get_public_static_data_members(info type);
  6. consteval vector get_public_nonstatic_data_members(info type);
  7. consteval vector get_public_bases(info type);
  8. consteval vector enumerators_of(info type_enum);

Next Steps

We finalized the review on [meta.reflection.queries] (aside from: is_type_alias(info r), is_namespace_alias(info r) (both replacing is_alias), has_internal_linkage(info r), has_module_linkage(info r), has_external_linkage(info r), has_linkage(info r), which required core’s wording approval), [meta.reflection.extract] and [meta.reflection.member.queries].

Next time we will continue with [meta.reflection.result] (reflect_invoke), [meta.reflection.trans] and [meta.reflection.rel].

[meta.reflection.unary] may be able to be reviewed via the reflector.

@ben-craig
Copy link
Collaborator

ben-craig commented Oct 10, 2024

2024-10-10 Library Evolution Telecon

P2996R7: Reflection for C++26

2024-10-10 Library Evolution Telecon Minutes

Champion: Dan Katz
Chair: Ben Craig
Minute Taker: Eddie Nolan

Summary

Important polls

has_identifier: missing "true" in many of the 1.* bullets.

Ensure that anonymous members gets discussed in evolution (or confirm that it was done).

POLL: Prohibit has_identifier and identifier_of from being used on a std::meta::info containing a data_member_spec

SF WF N WA SA
0 1 0 9 1

Attendance: 15
# of Authors: 3
Author Position: 3xWA
Outcome: Consensus against
Comments: WF: too clever

POLL: Entities with implementation-defined names should return false for has_identifier() and fail constant evaluation with identifier_of()

SF WF N WA SA
2 8 0 1 0

Attendance: 14
# of Authors: 3
Author Position: 3xWF
Outcome: Consensus in favor
Comments: WA: if it has a name, then it should be discoverable

POLL: Approve design of has_identifier, identifier_of, and u8identifier_of, with the modifications involving implementation-defined names above.

SF WF N WA SA
5 4 0 0 0

Attendance: 12
# of Authors: 3
Author Position: 2xSF, 1xWF
Outcome: Unanimous consent

We approved the following functions with modifications:

(changed behaviour for implementation-defined names)

  1. has_identifier
  2. identifier_of
  3. u8identifier_of

Next Steps

Looking at "enum class operators" next. Then Continue review on remaining facilities: [meta.reflection.queries] (received wording feedback on "alias" functions), [meta.reflection.result] (reflect_invoke), [meta.reflection.trans] and [meta.reflection.rel].

@wg21bot
Copy link
Collaborator Author

wg21bot commented Oct 17, 2024

P2996R6 Reflection for C++26 (Barry Revzin, Wyatt Childers, Peter Dimov, Andrew Sutton, Faisal Vali, Daveed Vandevoorde, Dan Katz)

@wg21bot wg21bot changed the title P2996 R5 Reflection for C++26 P2996 R6 Reflection for C++26 Oct 17, 2024
@wg21bot
Copy link
Collaborator Author

wg21bot commented Oct 17, 2024

P2996R7 Reflection for C++26 (Barry Revzin, Wyatt Childers, Peter Dimov, Andrew Sutton, Faisal Vali, Daveed Vandevoorde, Dan Katz)

@wg21bot wg21bot changed the title P2996 R6 Reflection for C++26 P2996 R7 Reflection for C++26 Oct 17, 2024
@inbal2l
Copy link
Collaborator

inbal2l commented Oct 21, 2024

2024-10-17 Library Evolution Telecon

P2996R7: Reflection for C++26

2024-10-17 Library Evolution Telecon Minutes

Champion: Dan Katz
Chair: Fabio Fracassi
Minute Taker: Eddie Nolan

Summary

(Approval polls are in the minutes and are not attached here this time, as they are equivalent to the list below and don't provide additional info over the summary)

Modification polls

POLL: Rename [u8]operator_symbol_of -> [u8]symbol_of

SF WF N WA SA
1 7 2 4 0

Attendance: 15
# of Authors: 3
Author Position: 1xWA, 1xN, 1xWA
Outcome: Weak consensus in favor

We approved the following functions with modifications:

(name change)

  1. consteval operators operator_of(info r);
  2. consteval string_view symbol_of(operators op); (was operator_symbol_of)
  3. consteval u8string_view u8symbol_of(operators op) (was u8operator_symbol_of)

We approved the following functions as is:

  1. consteval string_view display_string_of(info r); (post SG16 review)
  2. consteval u8string_view u8display_string_of(info r); (post SG16 review)
  3. has_internal_linkage(info r); (post core wording review)
  4. has_module_linkage(info r); (post core wording review)
  5. has_external_linkage(info r); (post core wording review)
  6. has_linkage(info r); (post core wording review)
  7. is_type_alias(info r); (post core wording review)
  8. is_namespace_alias(info r) (post core wording review)
  9. is_mutable_member(info r);
  10. is_user_declared(info r);

Next Steps

We approved the list of functions with naming and wording fixes as described in the summary.

Continue review on remaining facilities: [meta.reflection.layout], [meta.reflection.result], (reflect_invoke), [meta.reflection.define_class], [meta.reflection.define_static], if time left, we will also go over: [meta.reflection.trans] and [meta.reflection.rel].

@inbal2l
Copy link
Collaborator

inbal2l commented Nov 8, 2024

2024-10-29 Library Evolution Telecon

P2996R7: Reflection for C++26

2024-10-29 Library Evolution Telecon Minutes

Champion: Dan Katz
Chair: Inbal Levi
Minute Taker: Daveed Vandervoode

Summary

(Approval polls are in the minutes and are not attached here this time, as they are equivalent to the list below and don't provide additional info over the summary)

Direction polls

POLL: LEWG likes the interface presented in: define_static_string, define_static_array.

SF WF N WA SA
8 7 4 0 0

Attendance: 28
Author Position: 3xSF
Outcome: Consensus in favor

POLL: LEWG sees value in having “define_class” interface in C++26 regardless of whether P3294R0 or an alternative goes into C++26.

SF WF N WA SA
11 2 3 1 4

Attendance: 25
Author Position: 3xSF
Outcome: Consensus in favor

We approved the following with changes:

  1. members_offset struct:
    1. Modify the name from member_offsets into member_offset
    2. Make “bytes”, “bits” members of member_offset struct signed
  2. consteval member_offset offset_of(info r); (returned struct changed)

We approved the following functions as is:

  1. consteval size_t size_of(info r);
  2. consteval size_t alignment_of(info r);

ACTION: EWG should look at the functions in section: [meta.reflection.define_static], static generation:

  • define_static_string
  • define_static_array

(both define_static_string and define_static_array were added after R4 which is the one approved by EWG)
EWG - please consider other ways to produce compile-time storage which can be carried to runtime.

Next Steps

We approved the list of functions with naming and wording fixes as described in the summary.

Finalized: [meta.reflection.layout].
Next meeting, we will review: [meta.reflection.result] (reflect_invoke), [meta.reflection.define_class], [meta.reflection.define_static].
We will also start a reflector review on traits: [meta.reflection.trans], [meta.reflection.unary] and [meta.reflection.rel].

@inbal2l
Copy link
Collaborator

inbal2l commented Nov 9, 2024

2024-11-05 Library Evolution Telecon

P2996R8: Reflection for C++26

2024-11-05 Library Evolution Telecon Minutes

Champion: Dan Katz
Chair: Inbal Levi
Minute Taker: Daveed Vandervoode

Summary

(Approval polls are in the minutes and are not attached here this time, as they are equivalent to the list below and don't provide additional info over the summary)

We approved the following with changes:

  1. [meta.reflection.define_aggregate] section, including:
    1. data_member_options_t struct (Rename “width” into “bit_width”).
    2. consteval auto data_member_spec(info type, data_member_options_t options = {}) -> info; (Mandate passing name in the define_aggregate interface).
    3. template <reflection_range R = initializer_list<info>> consteval auto define_aggregate(info type_class, R&&) -> info;
    4. Apply different wording fixes (and add a NOTE to refer to core terms).

We approved the following as is:

  1. Everything under: [meta.reflection.unary] ([meta.reflection.unary.cat], [meta.reflection.unary.comp], [meta.reflection.unary.prop], [meta.reflection.unary.prop.query] apart from "is_reflection_type".
  2. Everything under: [meta.reflection.trans]

POLL: Forward “P2996R8” with fixes discussed in the room (without "Is_reflection_type", [meta.reflection.rel], [meta.reflection.tuple.variant]) to LWG for C++26 (without electronic poll).

SF WF N WA SA
11 4 0 1 1

Attendance: 19
Author Position: 4xSF
Outcome: Consensus in favor
SA: The proposal has design issues I consider unresolved; premature to send it.

NOTE: As we ran out of time but didn't want to hold proposal back, we forwarded the paper without (will be reviewed in the beginning of Wroclaw): is_reflection_type, [meta.reflection.rel], [meta.reflection.tuple.variant].

Next Steps

We approved the list of functions with naming and wording fixes as described in the summary.
P2996R8 was forwarded to LWG for C++26, without an electronic poll (main reasons: electronic poll will prevent review in Wroclaw which may slow down the process, we also had over 10 meetings so there were a lot of opportunities to bring up issues).
Due to time constraints, the paper was forwarded without: is_reflection_type, [meta.reflection.rel], [meta.reflection.tuple.variant]. These will be reviewed at the beginning of Wroclaw, and pulled out if needed. As this topic is a high priority, we of course welcome follow-up papers proposing fixes, if required.

@inbal2l inbal2l added LWG Library lwg-pending LWG Chair needs to disposition and removed ready-for-library-evolution-meeting-review This paper needs to be discussed at a Library Evolution meeting scheduled-for-library-evolution This paper has been scheduled for one of the groups: LEWG, LEWG Incubator, or a Mailing List review LEWG Library Evolution SG16 Text processing labels Nov 9, 2024
@bstamour bstamour moved this to In Progress in 2024 Poland LWG Schedule Nov 19, 2024
@jensmaurer
Copy link
Member

CWG 2024-11-19 in Wroclaw: Reviewed D2996R8; needs updates.

@jensmaurer
Copy link
Member

CWG 2024-11-21 in Wroclaw: Reviewed D2996R8; needs updates.

@jensmaurer jensmaurer moved this from Ready for review to Awaiting updated wording in CWG Nov 21, 2024
@jensmaurer jensmaurer added the needs-revision Paper needs changes before it can proceed label Nov 21, 2024
@JeffGarland JeffGarland added lwg-fullreview Paper is ready for lwg full group review and removed lwg-pending LWG Chair needs to disposition labels Dec 1, 2024
@JeffGarland JeffGarland moved this to In Progress in 2025 Hagenberg LWG Schedule Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++26 Targeted at C++26 CWG Core IS Ship vehicle: IS LWG Library lwg-fullreview Paper is ready for lwg full group review needs-revision Paper needs changes before it can proceed reflection size - large paper size estimate
Projects
Status: In Progress
Status: In Progress
Status: Awaiting updated wording
Development

No branches or pull requests