Repository navigation
feat: named merge slots - #15
Merged
Merged
Conversation
A fan-in group can name the slots of a merge, `(raw: msg, checked: valid) -> Merge`, and is then matched by name, in any order; the merge receives its slots in the order it declares them. This catches two same-typed slots wired the wrong way round, which slot types alone cannot. Merges declare names with MergeStage::mergeInputNames(), or with new registerTypedMergeFilter / registerMergeFilter overloads taking the names. Positional groups keep working. Unknown or missing names, partly named groups and names on a merge without declared names are build-time diagnostics; toMermaid labels the links with the slot names. Implements TODO item 1.
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.
Implements TODO item 1.
What
A fan-in group can name the slots of a merge and is then matched by name, in any order:
Slot types can't tell two slots of the same type apart, so swapping them used to pass validation and run silently wrong. With names, the merge always receives its slots in the order it declares them.
API
MergeStage::mergeInputNames()— override in aTypedMergeFilter/UniformMergeFilter(or hand-written) merge.mergeInputTypes()is no longer pure, so a merge can declare names only.registerTypedMergeFilter<Out, Ins...>(name, slotNames, merger)andregisterMergeFilter<Out>(name, slotNames, combiner)overloads.AnyMessageFilter::mergeInputNames()(defaults to none);MergeFilternow implementsMergeStage.dsl::StageNode::slotNames;toMermaidlabels the links with slot names.Rules
slot 'raw' of 'Merge' expects ....Both parsers (lexy and the deprecated hand-written one) accept the syntax and still produce identical results.
Docs / tests
README (new "Named slots" section), EXAMPLE.md section 4 +
textPipelinedemo 3c, CHANGELOG, TODO (item removed, rest renumbered). NewNamedSlotTests.cpp, plus parser-agreement cases. All 96 tests pass (MSVC debug, ASan).