Patternia v0.8.0 Release Note¶
Release Date: February 27, 2026
Version: 0.8.0
Overview¶
Patternia v0.8.0 is an API and performance release.
Compared with v0.7.6, this version removes the legacy
match(x, cases(...)).end() terminal form and focuses the public usage on
match(x) | on{...}. It also upgrades variant dispatch internals with a
tiered hot/warm/cold strategy for better large-branch behavior.
Highlights¶
API Update (Breaking)¶
- Removed legacy terminal API:
match(x, cases(...)).end()- Recommended forms in v0.8.x:
match(x) | on{...};match(x).when(...).when(...).end();for chained style (deprecated; planned for future removal)match(x).when(...).otherwise(...);for non-exhaustive matches (deprecated; planned for future removal)
Performance: Core Dispatch Algorithms in v0.8.0¶
- Added explicit variant dispatch tiering:
hot_inlinefor small alternative countswarm_segmentedfor medium alternative countscold_compactfor large alternative counts- Added compact index mapping for large typed-variant dispatch:
active_index -> compact slot- miss goes directly to fallback path
- hit jumps into dense trampoline table
- Added typed-variant per-alt case-range narrowing:
- only scans the relevant case range for the active alternative
- Retained direct-reference bind fast path for variant typed bindings to reduce tuple plumbing on common paths.
- Separated hot entry logic from cold large-branch logic using non-inline cold helpers to reduce hot-path code footprint.
Internal Architecture Cleanup¶
- Further separated optimization metadata from runtime evaluation flow:
- strategy/metadata stays in
optimize.hpp - runtime execution stays in
eval.hpp
Migration Guide¶
If you still use legacy terminal form, migrate to pipeline or chained API.
Before:
auto r = match(x, cases(
lit(1) >> [] { return 1; },
__ >> [] { return 0; }
)).end();
After:
auto r = match(x) | on{
lit(1) >> [] { return 1; },
__ >> [] { return 0; }
};
Compatibility Notes¶
- API surface: breaking change in 0.8.0 due to removal of
match(x, cases(...)).end(). - Runtime semantics: unchanged for equivalent case ordering and fallback behavior.
- Source compatibility: users of
match(x) | on{...}and chain.when(...).end()/.otherwise(...)remain compatible.
Implementation Notes¶
include/ptn/core/common/optimize.hpp- Added dispatch tier model and variant metadata helpers.
include/ptn/core/common/eval.hpp- Integrated hot/warm/cold dispatch flow and cold-path helpers.
- Updated typed/simple variant dispatch to use compact metadata.