Repository navigation
fix(post): state the one definition rule of the hookless clone mixin - #266
Merged
Merged
Conversation
Episode 4 now says every translation unit must see the same classes in the searched namespace, from a review of the old repo's port, and that the port checks it with a two-unit test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The post needs to clarify that another namespace can contain a separate closed hierarchy but cannot extend the original base’s clone dispatch, which still throws for the out-of-namespace derived class.
1 open issue
What changed in this PR
This documentation-only update clarifies the one definition rule requirement for Episode 4's reflection-based, hookless clone mixin.
Changes:
- Adds a cross-reference from the namespace-search explanation to the new section.
- Explains the need for consistent class sets across translation units, possible failure symptoms, and the port's two-unit verification test.
| File | Description |
|---|---|
src/content/posts/2026-12-21-std-polymorphic-instead-of-clone.mdx |
Documents cross-translation-unit consistency requirements for the hookless mixin. |
Review effort: Balanced
|
|
||
| ## One definition rule for the hookless mixin | ||
|
|
||
| Every translation unit of a program must see the same classes in the searched namespace, so the hierarchy belongs in one header. A unit that sees a different set generates a different `clone()` for the same specialization, which is undefined. It can show up as `clone_unavailable` for a class the caller can see. The way to extend the set is another namespace. The 2014 repo's port checks the requirement with a test that links two translation units and compares the class lists each one sees. |
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.

Episode 4 gains a short section: every translation unit must see the same classes in the searched namespace, or the hookless clone() differs between units for the same specialization. From a review of the old repo's port, which now guards it with a two-unit test and a mutant twin. Prose-lint clean, production build exits 0.
Generated with Claude Code