Repository navigation
docs(readme): rewrite the README for v0.9.6 - #111
Conversation
82cf8c2 to
c01ddf5
Compare
There was a problem hiding this comment.
Review: request changes
This is a solid README rewrite for v0.9.6. The new forms are used consistently: plain values in patterns (is<int>(0), any('a', 'e', ...)), $ as a last-case fallback, expression handlers, and named-member guards. The mixed lit/val classify example is gone, the event-dispatch placeholders were renamed so they do not clash with the Point bindings, and the PTN_ON scope warning is the right thing to put on the front page.
The examples I checked against the headers and the API docs look correct, including the owning std::unique_ptr match, alt<1>(""), collatz_step ending in $, and the dense val<0x00..0x05> list.
One accuracy issue should be fixed before merge. The owning section and the performance table both present owned/variant dispatch as identical to the borrowed path. The API and the Performance Tuning guide document a real exception: an owned std::variant with four or fewer alternatives is evaluated in source order; the index() switch starts at five alternatives. Please qualify those two places so the README matches the rest of the docs.
Optional, non-blocking: the val<N> row says "on an integer"; the planner also builds that dense table for unscoped enums (scoped enum class currently stays in source order).
Show the v0.9.6 forms throughout: plain values inside patterns, `$` as the last case, expression handlers and guards over named struct members, and owning matches on rvalue subjects. Add sections on owning the subject and on reusing case lists, and a performance section that says which case lists compile to a switch. Fix two statements that were wrong: `_` is no longer the only fallback, and the `classify` example that mixed `lit` and `val` claimed static dispatch, which a mixed list does not get.
c01ddf5 to
2e621f3
Compare
There was a problem hiding this comment.
Review: approve
The two accuracy issues from the last review are fixed. The owning section now states that an owned std::variant with four or fewer alternatives is matched in source order, and the performance table qualifies that the index() switch for an owned variant starts at five alternatives. That matches the API and the Performance Tuning guide.
The rest of the v0.9.6 README rewrite still looks consistent with the library: plain values in patterns, $ as a last-case fallback, expression handlers, named-member guards, the owned std::unique_ptr example, and the PTN_ON scope note.
Superseded: the requested README qualifications were addressed in 2e621f3, which is now approved.
There was a problem hiding this comment.
Review: approve
The owned-variant exception is now documented in both places I asked about: the owning section qualifies that an owned std::variant with four or fewer alternatives is matched in source order, and the performance table notes that the index() switch for an owned variant needs five or more alternatives. That matches the API docs and the Performance Tuning guide.
The rest of the rewrite still looks correct: the v0.9.6 forms, the mixed lit/val classify fix, the event-dispatch placeholders, and the PTN_ON scope note. Moving the performance section up and replacing the gap-map image with the measured table is a clearer front-page summary.
No further changes requested.
There was a problem hiding this comment.
Review: approve
This push merges main into the branch (the v0.9.6 vcpkg portfile SHA512 update from #110). The README corrections from the last review are still in place: the owning section says an owned std::variant with four or fewer alternatives is matched in source order, and the performance table notes that the index() switch for an owned variant needs five or more alternatives.
No further changes requested.
Summary
Rewrite the README around the v0.9.6 features.
Changes
in patterns (
is<int>(0),any('a', 'e', ...)),$as the lastcase, expression handlers (
$ >> (_ * 3 + 1),>> (x + y)), andguards over named struct members.
match(std::move(job))with astd::unique_ptr), reusing case lists (constexprpacks andPTN_ON), and a performance section with the plan table from thetuning guide and the codegen check.
matchborrows lvalues and owns rvalues;onends in_or an unguarded$; handlers may be expressions; plain valuesmean
lit(value)._was described as the only fallback, andclassifymixedlit(0)withval<1>while claiming static dispatch; a mixed listis evaluated in source order. The dense example now uses
val<N>only.
unchanged apart from a Performance Tuning link.
Testing
assertions on its results, with
-Wall -Wextra -Werroron AppleClang 17 and GCC 13 (C++17).
static_asserts confirm that theval<N>opcode example and theconstexprparity pack get the dense-table plan.