Issue #2709: The other methods of a @stream walk: scoped thread, owned at the boundary, the Rust reader’s owned form, walking twice, the ledger’s line (ADR-grammar-typed-read-v1 D7)

Open and answer this issue on GitHub.

ready · opened 2026-11-22 · updated 2026-11-22 · 1 comment

Part of #2426 After #2708

What it is

ADR-grammar-typed-read-v1 D7, as rewritten after the owner’s decision on #2426 (2026-11-22), makes a @stream call a sequence like any other. It may be held, passed on, handed back, stored, given to a task and combined. An item views the input, and the compiler chooses how each walk runs. “A for over a @stream call runs its body as the parser’s each” (#2708) builds the direct for (push) and refuses the other uses where the item holds a view (NK1355). This issue builds the methods for those uses, so nothing is refused.

To build

  1. Scoped thread. A held or passed sequence with one consumer the compiler cannot see through, and a for whose body pauses, run the parser on a thread that borrows the input (std::thread::scope), so items keep their views.
  2. Owned at the boundary. A sequence that outlives the input’s loan (stored, given to a task, sent away) runs on its own thread with the input owned. Its items are converted to an owned form of the item type where they leave the thread, generated beside it.
    • NK1355 and its interim refusals go.
  3. The Rust reader (G::<rule>_reader(r)) hands out the owned form of item 2; NK1345 applies to that form.
  4. Walked twice. A held sequence walked twice parses twice, and the ledger names it. The compiler may collect it once where it sees that is cheaper.
  5. The ledger names, per walk, the method chosen and where a copy is made. A lint names a walk that fell to the copying method.
  6. Tests in tests/compiler/tests/ for each row of D7’s table, with the ledger’s line.

Done when

Each use D7 names (held, passed on, handed back, stored, given to a task, combined, walked twice) compiles and runs with items that view the input where the loan covers the walk. NK1355 is retired. The ledger names the method per walk, and a test per row is green.

Comments

keywan-ghadami, 2026-11-22

From the report of the run of issue-2708-run3 (#2708):

the thread walks of a @stream whose items view the input are refused with NK1359 (emit_stream_thread_refused in emit_grammar.nika); building a thread that borrows the input lifts it


Generated by Claude Code

Back to Open Issues