Repository navigation
Make every example in the dynamics API reference compile - #606
Merged
Merged
Conversation
godofecht
force-pushed
the
docs-dynamics-imports
branch
from
August 19, 2026 23:10
e055c59 to
82cb7c8
Compare
docs/library/dynamics.md had eight unverified blocks and now has none. Each section stated its import in prose, above the fence rather than in it, so no block could be copied and run. The imports are in the blocks now. Two blocks referenced buffers that were never declared: the Matrix values pointed at a_buf, b_buf and c_buf, and the Gramian, GA and closed-loop calls passed scratch arrays out of nowhere. Those are declared, sized from the signatures in lib/stdlib/dynamics/, with a line saying what each is for. A reader copying any of these now gets a program. The four blocks that build on the system built earlier on the page say so with uses=, rather than repeating twelve lines of setup each time. Two fixes to the uses= mechanism, both found by this being its first real use: Page context now joins the block's own code rather than the preamble, so the harness wraps both together. Above it, `let sys = dsys_discrete(...)` landed at module scope, where the parser requires `let mut`, and every one of these blocks failed for a reason unrelated to the example. Imports hoist when context is joined. A block naming context also imports its own module, so joining them left an `import` after the context's statements and every harness rung read it as an expression. unverified: 220 -> 212. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
godofecht
force-pushed
the
docs-dynamics-imports
branch
from
August 19, 2026 23:15
82cb7c8 to
2923f63
Compare
godofecht
added a commit
that referenced
this pull request
Aug 20, 2026
PR #606 already made the detailed dynamics reference compile without deleting its API signatures and examples. Preserve that focused cleanup instead of the older broad rewrite.
godofecht
added a commit
that referenced
this pull request
Sep 7, 2026
PR #606 already made the detailed dynamics reference compile without deleting its API signatures and examples. Preserve that focused cleanup instead of the older broad rewrite.
godofecht
added a commit
that referenced
this pull request
Sep 7, 2026
PR #606 already made the detailed dynamics reference compile without deleting its API signatures and examples. Preserve that focused cleanup instead of the older broad rewrite.
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.
docs/library/dynamics.mdhad eight unverified blocks and now has none.unverified: 220 -> 212.Why they failed
The imports were in the prose, not the fence. Each section says:
above the block rather than inside it, so no block could be copied and run. They are in the blocks now.
Buffers appeared from nowhere. The
Matrixvalues pointed ata_buf,b_buf,c_buf, and the Gramian, GA and closed-loop calls passed scratch arrays that were never declared. Those are declared now, sized from the actual signatures inlib/stdlib/dynamics/, each with a line saying what it is for:A reader copying any of these now gets a program rather than a fragment.
Twelve lines of setup would have been repeated four times. The blocks that build on the system constructed earlier say
uses=systeminstead.Two fixes to
uses=, found by its first real useThis is the first page to use the mechanism from #584 in anger, and it exposed two things.
Context belongs inside the harness. I had put it in the preamble, above the block. A chapter's earlier block is usually statements, so
let sys = dsys_discrete(...)landed at module scope where the parser requireslet mut. Every one of these blocks failed with an error about the harness rather than the example.Imports hoist when context is joined. A block naming context also imports its own module, so joining them naively left an
importin the middle, after the context's statements, and every harness rung read it as an expression:Both are covered by new tests, including one asserting a repeated import is joined once.
Verification
pytest tests/check_doc_examples.py --check-ledgercheck_doc_links.py