Repository navigation
Conversation
Problem - PTN_BIND is deprecated, but three tutorials still used it as the primary way to name guard placeholders. - The policy tutorial's guest rule did not compile: its predicate took one int, but the guard passes both members listed in has<...>. - The roadmap did not mention the unreleased has<...> naming work and pointed at an empty WIP section. Implementation - Rewrite other-languages, policy-constraint and sphere-constraint to declare names with auto [a, b] = has<...>. - Make is_public_resource take (Role, int) and explain that a callable guard receives every member listed in has<...>. - Add an unreleased block to the roadmap FINISHED list and fix the stale "see WIP above" reference. Tests - Compiled and ran the updated snippets with g++ and clang++ in C++17 and C++20.
There was a problem hiding this comment.
Thanks, this is a clean docs migration. Approving the content.
What I checked
other-languages,policy-constraintandsphere-constraintnow name guard placeholders withauto [..] = has<...>instead of the deprecatedPTN_BIND, matching the tuple-likehas<...>from #64 (tuple_size/tuple_elementspecializations withmember_t<...>elements instructural.hpp).- The
is_public_resourcefix is correct: a callable guard onhas<&Request::role, &Request::resource_id>receives both members, so the old(int)signature could not compile. The added sentence explaining that is helpful. - The note that names follow members rather than positions (reusing
rolefromrequestin the guest rule) matches themember_t<&Type::name>design, and it's good to call that out explicitly. - Reusing the
constexprpattern object in$(u)/$(request)/$(xyz)also reduces duplication of the member list. - Roadmap: the unreleased block lines up with #63 and #64 on
main, and replacing the stale "see WIP above" with "shipped in v0.9.4" is right.
CI items to sort out before merge (not about the doc content)
commit-stylefails because the PR body is missing the required sections. It expects**Summary**,**Changes**and**Testing**headings; the current body uses Problem / Implementation / Tests. Renaming those sections in the PR description should fix it (no new commit needed).clang-14 C++17andclang-16 C++20fail at the setup step withE: Package 'clang-14' has no installation candidate(apt exit 100). That looks like theubuntu-latestrunner image moving to a newer Ubuntu, not this PR. Pinning those jobs toubuntu-22.04/ubuntu-24.04or installing from apt.llvm.org in a separate PR should unblock it.
Nit (optional): in sphere-constraint, x and y are unused. GCC/Clang don't warn as long as one binding is used, so this is fine, but if you want to model it for users you could mention [[maybe_unused]] auto [x, y, z] = xyz; for cases where none are used.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Benchmark comparison (informational)Base Noise estimate: the 20 control rows below do not run Patternia code, so they should not change between base and PR. As a group they moved by a median of +0.0% (run order and machine drift); that offset is divided out of the Patternia deltas (Adjusted). The controls then scatter by a median of 0.3%. Adjusted differences under 5.0% are treated as noise. Patternia: 8 benchmarks, 1 slower, 0 faster, 7 within noise.
Control rows (not Patternia code)
Raw results and the comparison chart are attached to this workflow run as an artifact. Shared runners are noisy, so use this as a trend, not a measurement. |
Summary
Migrate the remaining tutorials from the deprecated
PTN_BINDto structured-binding member names (auto [a, b] = has<...>), fix a tutorial example that never compiled, and bring the roadmap up to date with unreleased work on main.Changes
other-languages,policy-constraint,sphere-constraint: declare guard names withauto [...] = has<...>instead ofPTN_BIND.policy-constraint:is_public_resourcenow takes(Role, int). A callable guard receives every member listed inhas<...>, so the old one-argument version failed to compile; a short note explains this.roadmap: add an unreleased block to FINISHED (has<...>tuple-like names,PTN_BINDdeprecation, bareis<T>/alt<I>fast path) and fix the stale "see WIP above" reference.Testing
-Wall -Wextra.mkdocs buildwas not run locally.🤖 Generated with Claude Code