feat(dsl): extend PTN_BIND to 10 names via chained macros - #44
Merged
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend
PTN_BINDfrom 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
PTN_BIND_DECL(Index, name)as the single declaration generator, terminating each declaration itself.PTN_BIND_1..PTN_BIND_10by chaining:PTN_BIND_Nexpands toPTN_BIND_{N-1}plus one new declaration.PTN_BIND_PICKand the count-dispatch table to 10 entries.PTN_BIND_EXPANDwrapping at every indirection layer for MSVC traditional preprocessor compatibility.docs/api.mdto state the new one-to-ten limit.Testing
Decafixture coveringPTN_BINDat arity 10: placeholder type correctness (arg_t<0>/arg_t<9>) plus pass/fail guard evaluation.