Merged
Conversation
…ue, and error handlers
…tic, error handling, and concurrency policies
…BehaviorProtocol prompt
…tion for operand representations
…and comparison delegates
…an and character types
… policy, concurrency policy, custom underlying, custom policy, and custom operations
There was a problem hiding this comment.
Pull request overview
This PR bumps the project version to 0.2.0 while also landing a substantial refactor of the primitives “policy/operation” stack to a handler-protocol + dispatcher pipeline architecture, plus updated tests and a refreshed set of examples.
Changes:
- Introduces policy handler protocol modules (
policy.handler,policy.utility) and reworks built-in policies/tags into category sub-namespaces (policy::value::*,policy::type::*, etc.). - Replaces the previous operations implementation with capability-tagged operations + a central dispatcher/invoker pipeline (concurrency → value → error).
- Updates/expands tests and replaces the single “basic” example with a set of focused examples (CMake + xmake).
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/basic/test_templates.cpp | Adds custom underlying/rep-type test coverage (custom numeric-like reps, rep validation, dispatcher behavior). |
| tests/basic/test_policies.cpp | Updates policy tag names and adds protocol/concurrency/capability tests. |
| tests/basic/test_operations.cpp | Rewrites operations tests for the new dispatcher + policy pipeline (value/error/type/concurrency behaviors). |
| src/underlying/traits.cppm | Extends underlying rep-type eligibility to allow “custom numeric-like” rep types and adjusts category consistency rules. |
| src/primitive/traits.cppm | Updates default policy resolution to use policy::defaults::*. |
| src/policy/utility.cppm | New: priority-based policy selection/merging utilities (common_policies_t). |
| src/policy/traits.cppm | Simplifies policy traits to concepts only (policy tags/merging moved out). |
| src/policy/policy.cppm | Exports new policy submodules (policy.handler, policy.utility). |
| src/policy/impl.cppm | Defines built-in policy tags in category namespaces + default handler specializations. |
| src/policy/handler.cppm | New: defines handler protocol contracts and shared types for error/value/type/concurrency policy layers. |
| src/operations/traits.cppm | Refactors operations traits into arity/capability metadata and validation concepts. |
| src/operations/operators.cppm | Implements operations::apply/add/sub/mul/div/equal/not_equal + operator overloads routed through the dispatcher. |
| src/operations/operations.cppm | Re-exports dispatcher as part of the operations entry module. |
| src/operations/invoker.cppm | New: runtime value op bindings + checked/unchecked/saturating arithmetic and error construction helpers. |
| src/operations/impl.cppm | Redefines built-in operation tags (Addition/Subtraction/…) and their capability metadata. |
| src/operations/dispatcher.cppm | New: compile-time negotiation + runtime pipeline dispatcher (rep validation, normalization, handler chaining). |
| examples/xmake.lua | Replaces single example target with a loop building multiple example binaries. |
| examples/ex01_default_arithmetic.cpp | New: demonstrates default arithmetic through operators/dispatcher. |
| examples/ex02_type_policy.cpp | New: demonstrates strict vs compatible type policy negotiation (compile-time). |
| examples/ex03_value_policy.cpp | New: demonstrates checked/unchecked/saturating overflow behavior. |
| examples/ex04_error_policy.cpp | New: demonstrates expected vs throwing error behavior. |
| examples/ex05_concurrency_policy.cpp | New: demonstrates atomic concurrency policy consistency under concurrency. |
| examples/ex06_custom_underlying.cpp | New: demonstrates custom underlying traits + rep validation mapped to domain errors. |
| examples/ex07_custom_policy.cpp | New: demonstrates implementing custom policy handlers and op bindings. |
| examples/ex08_custom_operation.cpp | New: demonstrates adding custom operations + runtime bindings. |
| examples/basic.cpp | Removes the old monolithic basic example. |
| examples/CMakeLists.txt | New: builds each example as its own executable linked against the library. |
| README.md | Updates documentation to the new policy tag namespaces and protocol surface. |
| CMakeLists.txt | Bumps version to 0.2.0; switches module file globbing to CONFIGURE_DEPENDS; moves examples to subdirectory. |
| .github/prompts/plan-policyBehaviorProtocol.prompt.md | New: design/plan doc describing the policy behavior protocol and dispatcher approach. |
| .github/copilot-instructions.md | Links the current in-progress plan under .github/prompts/. |
| .agents/docs/architecture.md | Documents stdlib usage convention for modules (headers in global module fragment; avoid import std;). |
You can also share your feedback on Copilot code review. Take the survey.
…d add missing include
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.
No description provided.