Skip to content

[super! 2/6] Give each convention a single overload type - #67

Open
mingxwa wants to merge 1 commit into
ngcpp:feature/v5from
mingxwa:user/mingxwa/super-stage2
Open

[super! 2/6] Give each convention a single overload type#67
mingxwa wants to merge 1 commit into
ngcpp:feature/v5from
mingxwa:user/mingxwa/super-stage2

Conversation

@mingxwa

@mingxwa mingxwa commented Aug 15, 2026

Copy link
Copy Markdown
Member

A convention carried a tuple-like overload_types, so adding a convention had to search Cs for an existing convention with the same is_direct and dispatch_type and merge the overload lists into it. That merge is the only reason add_conv_t, merge_conv_t, add_conv_reduction, and conv_specialization_t exist.

  • overload_types becomes a single overload_type. add_convention contributes one convention per overload, and merging a convention into Cs becomes deduplicating concatenation. Duplicates are still collapsed, so build is unaffected at both compile time and run time.
  • Accessors are still formed per dispatch type (otherwise a dispatch with several overloads would contribute several accessor bases instead of one overload set). conv_group and conv_groups_merge_t regroup the conventions by dispatch type just before generating the accessors, which also keeps overload shadowing working.
  • Generalizes the reduction helpers to carry extra arguments (reduction_t) and adds flattening_merge_t, which merge_tuples_t and conv_groups_merge_t are both expressed in terms of.

Breaking change. ProBasicConvention and ProConvention change, so a hand-written convention type must be updated.

A convention used to carry a tuple-like overload_types, so adding a
convention had to search Cs for an existing convention with the same
is_direct and dispatch_type and merge the overload lists into it. That
merge is the only reason add_conv_t, merge_conv_t, add_conv_reduction,
and conv_specialization_t exist.

Replace overload_types with a single overload_type, so add_convention
contributes one convention per overload and merging a convention into Cs
becomes deduplicating concatenation. Duplicates are still collapsed, so
build() is unaffected at both compile time and run time.

Accessors still have to be formed per dispatch type, or a dispatch with
several overloads would contribute several accessor bases instead of one
overload set. Regroup the conventions by dispatch type via conv_group
and conv_groups_merge_t just before generating the accessors, which also
keeps overload shadowing working.

Generalize the reduction helpers to carry extra arguments (reduction_t)
and add flattening_merge_t, which merge_tuples_t and conv_groups_merge_t
are both expressed in terms of.

This changes the ProBasicConvention and ProConvention requirements, so a
hand-written convention type must be updated.
@mingxwa mingxwa changed the title Give each convention a single overload type [super! 2/6] Give each convention a single overload type Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant