Skip to content

feat: add neg(p) pattern combinator + variant inline dispatch optimization + val<> compile-fail diagnostic#29

Merged
sentomk merged 1 commit intov0.9.3from
feat/neq-and-perf
May 4, 2026
Merged

feat: add neg(p) pattern combinator + variant inline dispatch optimization + val<> compile-fail diagnostic#29
sentomk merged 1 commit intov0.9.3from
feat/neq-and-perf

Conversation

@sentomk
Copy link
Copy Markdown
Owner

@sentomk sentomk commented May 3, 2026

Summary

Adds neg(p) negation pattern combinator, lowers variant inline dispatch threshold from 16 to 8, and adds a compile-fail diagnostic for val<> runtime value misuse.

Changes

File Change
include/ptn/pattern/negation.hpp New: negation pattern combinator (46 LOC)
include/ptn/patternia.hpp Wire neg into public API
include/ptn/core/common/optimize.hpp Lower k_variant_inline_dispatch_alt_threshold 16 → 8
tests/tests_combinator.cpp 4 neg tests (basic, wildcard, pred, double-negation)
tests/CMakeLists.txt Add compile-fail entry
tests/compile_fail/val_requires_compile_time_constant.cpp New: val<>(runtime_value) diagnostic test

Tests

  • 4 new neg(p) unit tests: basic negation, neg(_), neg(pred(...)), neg(neg(p))
  • 1 compile-fail test: val<>(runtime_value)
  • Full ctest: 154/154 pass, no regressions

Risk

Low. neg(p) is a new combinator with zero binding — does not affect existing match paths. Threshold change 16→8 only affects variant dispatch strategy (hot inline path for ≤8 alternatives), existing paths unchanged.

Checklist

  • Tests added or updated when behavior changed
  • Documentation updated when public API or behavior changed
  • Commit messages follow CONTRIBUTING.md
  • PR targets v0.9.3 and passes required CI

…zation + val<> compile-fail diagnostic

- Add neg(p) negation pattern combinator (46 LOC, negation.hpp)
- Lower k_variant_inline_dispatch_alt_threshold from 16 to 8 (optimize.hpp)
- Add compile-fail test for val<>(runtime_value) misuse
- Wire neg into patternia.hpp public API
@sentomk sentomk merged commit 1eac738 into v0.9.3 May 4, 2026
@sentomk sentomk deleted the feat/neq-and-perf branch May 4, 2026 13:06
sentomk added a commit that referenced this pull request May 4, 2026
…ation, user guides (#31)

* feat: add neg(p) pattern combinator + variant inline threshold optimization + val<> compile-fail diagnostic (#29)

- Add neg(p) negation pattern combinator (46 LOC, negation.hpp)
- Lower k_variant_inline_dispatch_alt_threshold from 16 to 8 (optimize.hpp)
- Add compile-fail test for val<>(runtime_value) misuse
- Wire neg into patternia.hpp public API

* docs: v0.9.3 release documentation — guides, release notes, performance note (#30)

* docs: add performance tuning and common mistakes guides

- docs/guide/performance-tuning.md: PTN_ON macro, val<> vs lit(), structural binding, variant dispatch
- docs/guide/common-mistakes.md: 6 common mistakes with val<> runtime misuse, missing wildcard, lambda captures, etc.

* docs: bump version to 0.9.3 + add neg(p) to API reference

- CMakeLists.txt: VERSION 0.9.2 → 0.9.3
- README.md: GIT_TAG v0.9.2 → v0.9.3
- docs/api.md: add neg(p) section with example + namespace summary

* docs(release): add v0.9.3 release note, update releases index, add neg example to README

* docs(perf): add v0.9.3 performance note (variant dispatch threshold tuning)

* docs(release): add performance section link to v0.9.3 release note

* style: apply clang-format to PR changes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
sentomk added a commit that referenced this pull request May 4, 2026
* release: v0.9.3 — neg(p) pattern combinator, variant dispatch optimization, user guides (#31)

* feat: add neg(p) pattern combinator + variant inline threshold optimization + val<> compile-fail diagnostic (#29)

- Add neg(p) negation pattern combinator (46 LOC, negation.hpp)
- Lower k_variant_inline_dispatch_alt_threshold from 16 to 8 (optimize.hpp)
- Add compile-fail test for val<>(runtime_value) misuse
- Wire neg into patternia.hpp public API

* docs: v0.9.3 release documentation — guides, release notes, performance note (#30)

* docs: add performance tuning and common mistakes guides

- docs/guide/performance-tuning.md: PTN_ON macro, val<> vs lit(), structural binding, variant dispatch
- docs/guide/common-mistakes.md: 6 common mistakes with val<> runtime misuse, missing wildcard, lambda captures, etc.

* docs: bump version to 0.9.3 + add neg(p) to API reference

- CMakeLists.txt: VERSION 0.9.2 → 0.9.3
- README.md: GIT_TAG v0.9.2 → v0.9.3
- docs/api.md: add neg(p) section with example + namespace summary

* docs(release): add v0.9.3 release note, update releases index, add neg example to README

* docs(perf): add v0.9.3 performance note (variant dispatch threshold tuning)

* docs(release): add performance section link to v0.9.3 release note

* style: apply clang-format to PR changes

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* ci: update benchmark summary chart

* hotfix(nav): add v0.9.3 to performance sidebar

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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