Skip to content

feat(dsl): extend PTN_BIND to 10 names via chained macros - #44

Merged
sentomk merged 1 commit into
mainfrom
feat/ptn-bind-arity-10
Aug 1, 2026
Merged

feat(dsl): extend PTN_BIND to 10 names via chained macros#44
sentomk merged 1 commit into
mainfrom
feat/ptn-bind-arity-10

Conversation

@sentomk

@sentomk sentomk commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

Extend PTN_BIND from 5 to 10 member names and refactor the arity macros into chained composition, so raising the limit in the future costs one short macro instead of a full rewrite. No DSL surface change for existing arity 1–5 usage.

Changes

  • Add PTN_BIND_DECL(Index, name) as the single declaration generator, terminating each declaration itself.
  • Redefine PTN_BIND_1..PTN_BIND_10 by chaining: PTN_BIND_N expands to PTN_BIND_{N-1} plus one new declaration.
  • Extend PTN_BIND_PICK and the count-dispatch table to 10 entries.
  • Keep PTN_BIND_EXPAND wrapping at every indirection layer for MSVC traditional preprocessor compatibility.
  • Update docs/api.md to state the new one-to-ten limit.

Testing

  • Add Deca fixture covering PTN_BIND at arity 10: placeholder type correctness (arg_t<0>/arg_t<9>) plus pass/fail guard evaluation.
  • Full suite passes locally: 182/182 (Clang 20, C++17), including compile-fail cases.
  • clang-format check clean on touched files.

Problem
- PTN_BIND supported at most 5 member names, which is tight for
  wider records such as protocol headers.
- Each PTN_BIND_N macro restated all declarations, so raising the
  arity limit meant rewriting every previous level.

Implementation
- Add PTN_BIND_DECL(Index, name) as the single declaration
  generator, terminating each declaration itself.
- Redefine PTN_BIND_1..PTN_BIND_10 by chaining: PTN_BIND_N expands
  to PTN_BIND_{N-1} plus one new declaration, so a new arity now
  costs one short macro instead of a full rewrite.
- Extend PTN_BIND_PICK and the count-dispatch table to 10 entries.
- Keep PTN_BIND_EXPAND wrapping at every indirection layer for MSVC
  traditional preprocessor compatibility.

Tests
- Add Deca fixture covering PTN_BIND at arity 10: placeholder type
  correctness (arg_t<0>/arg_t<9>) plus pass/fail guard evaluation.
- Full suite passes: 182/182, including compile_fail cases.
- clang-format check clean on touched files.

Notes
- No DSL surface change for arity 1-5; existing code keeps working.
- docs/api.md updated to state the new one-to-ten limit.
@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sentomk
sentomk merged commit 5f8e4b3 into main Aug 1, 2026
22 of 23 checks passed
@sentomk
sentomk deleted the feat/ptn-bind-arity-10 branch August 1, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant