interactive: import/export in the IR#749
Open
frankmcsherry wants to merge 1 commit into
Open
Conversation
365aca6 to
f267717
Compare
frankmcsherry
commented
Jun 8, 2026
frankmcsherry
left a comment
Member
Author
There was a problem hiding this comment.
Comments for Claude about things to tighten.
Add `import "name"` and `export "name" = expr` to the IR and both surface syntaxes, and remove the `result` statement: `export` is now the sole way to declare a program output, and only at the root scope. `Program.export` is a named list (was a single result id); `Node::Import` resolves against a registry at install time. `Node::Import` is a stub outside the server (the example renderers panic on it, no example uses it); the intended end-state is one named-source substrate that subsumes `Input(usize)` — there should not be two ways to bring in a source. `survey_sources` (was `count_inputs`) returns both kinds until that cutover. Threaded through lower, both parsers, explain, and the ddir_vec/ddir_col/ dump_explain examples; example programs now use `export "result" = …`. The string lexer is read-until-quote (no escapes — names don't use them). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
f267717 to
e5d28c3
Compare
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.
Adds
import/exportto the DD IR: generalizes the singleresultoutput to a named export list, and adds
Node::Importfor named externaltraces.
What
export "name" = expr;andimport "name";.result expr;becomes sugar for
export "$result" = expr;.Program.export: Vec<(String, Id)>(was a single result id);new
Node::Import { name }, resolved by shape against a registry.lower, both parsers,explain, and theddir_vec/ddir_col/dump_explainexamples.Why
Foundation for multi-output programs and named-trace inputs (the upcoming
live server resolves imports against its registry); the explanation rewrite
and a future optimizer also build on the export list.
Review notes
exportis fully functional standalone — the lib renderers use it.importis a declaration with no resolver in the lib: only a registrybinds it, so
ddir_vec/ddir_colpanic!on aNode::Importand noexample uses one yet. Compiler-IR "unresolved extern" pattern; the
resolver lands with the server. Lib + examples only — no server crate.