Skip to content

Patternia v0.9.2 Release Note

Release Date: April 10, 2026 Version: 0.9.2


Overview

Patternia v0.9.2 ships the any(...) / all(...) pattern combinators with comprehensive test coverage and API documentation.

Compared with v0.9.1, this version stabilizes the combinator API first introduced in v0.9.1, expands test coverage across all pattern types, and adds the corresponding API reference documentation.


New Features

any(ps...) — OR Pattern Combinator

Matches when at least one sub-pattern matches. Short-circuits on the first match.

match(x) | on(
  any(val<1>, val<2>, val<3>) >> "1, 2, or 3",
  _ >> "other"
);

Properties:

  • Non-binding: handlers receive zero arguments.
  • Sub-patterns are evaluated left-to-right; evaluation stops at the first match.
  • Requires at least one sub-pattern; every argument must be a pattern object.

all(ps...) — AND Pattern Combinator

Matches only when every sub-pattern matches. Short-circuits on the first mismatch.

match(x) | on(
  all(any(val<1>, val<2>), val<2>) >> "2",
  _ >> "other"
);

Properties:

  • Non-binding: handlers receive zero arguments.
  • Sub-patterns are evaluated left-to-right; evaluation stops at the first mismatch.
  • Requires at least one sub-pattern; every argument must be a pattern object.

Test Coverage

21 runtime tests and 4 compile-fail tests cover:

  • Short-circuit evaluation (any stops on first hit, all stops on first miss).
  • Composition with val<>, lit(), lit_ci(), and is<T>.
  • Nested combinators (any inside all and vice versa).
  • Single-subpattern edge cases.
  • Pattern reuse across multiple matches.
  • PTN_ON(...) cached case pack integration.
  • Static assertions for empty argument lists and non-pattern arguments.

Documentation

  • Added "Pattern Combinators" section to API reference (docs/api.md).
  • Updated namespace summary to include any and all.

Internal

  • tests/tests_combinator.cpp: 16 new runtime tests added.
  • tests/compile_fail/all_requires_pattern_args.cpp: new compile-fail regression test.
  • tests/CMakeLists.txt: registered new compile-fail test.
  • docs/api.md: added combinator section and namespace summary update.