Skip to content

feat(guard): unify placeholder syntax - #43

Merged
sentomk merged 1 commit into
mainfrom
feat/guard-placeholders
Jul 31, 2026
Merged

feat(guard): unify placeholder syntax#43
sentomk merged 1 commit into
mainfrom
feat/guard-placeholders

Conversation

@sentomk

@sentomk sentomk commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Unify Patternia's guard placeholder surface around _ for a single bound value and PTN_BIND names for multiple values. This is a breaking cleanup: the redundant wildcard alias and positional/macro guard alternatives are removed instead of retained as compatibility aliases.

Changes

  • make _ serve as both wildcard fallback and the index-zero guard expression
  • move the internal arg_t<N> primitive into a lightweight placeholder header
  • allow PTN_BIND declarations at both namespace and block scope
  • remove __, _0, public arg<N>, PTN_LET, and PTN_WHERE
  • add compile-fail contracts for every removed public spelling
  • migrate tests, samples, benchmarks, diagnostics, and current documentation
  • add a migration section covering the replacement syntax
  • complete the install header manifest so the umbrella header is consumable

Testing

  • GCC 12 / C++17 full build, samples, benchmarks, and 179/179 CTest cases passed
  • Clang 14 / C++17 build, samples, and 179/179 CTest cases passed
  • clang-format 18 dry-run and git diff --check passed
  • modular header include-order, standalone wildcard, and PTN_BIND multi-TU probes passed
  • installed-package umbrella-header consumer compiled and ran against only the install prefix

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.02564% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
include/ptn/pattern/type.hpp 67.64% 9 Missing and 2 partials ⚠️
include/ptn/core/common/common_traits.hpp 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Problem
- Guard syntax exposed positional and macro-based alternatives.
- The wildcard had a redundant double-underscore alias.

Implementation
- Reuse `_` for single-value guards and wildcard fallback.
- Keep `arg_t<N>` internal and expose names through PTN_BIND.
- Remove `__`, `_0`, `arg<N>`, PTN_LET, and PTN_WHERE.
- Migrate tests, samples, benchmarks, diagnostics, and docs.

Tests
- Cover both `_` roles, all guard operators, and removed APIs.
- Verify PTN_BIND at namespace and block scope.
- Build and test with GCC and Clang in C++17 mode.
@sentomk
sentomk force-pushed the feat/guard-placeholders branch from 3ec64e6 to 9b62e32 Compare July 31, 2026 14:15
@sentomk
sentomk merged commit ca64d65 into main Jul 31, 2026
23 checks passed
@sentomk
sentomk deleted the feat/guard-placeholders branch July 31, 2026 15:10
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