Expand description
ReplSession — the replay-based interactive session behind largo repl
(and any future notebook surface).
§Architecture: replay, not a persistent interpreter
The session accumulates source text — ## definition blocks and Main
statements — and on every eval composes them into
a complete program and re-runs it through
interpret_for_ui_with_args: the
exact engine behind largo run --interpret (VM+JIT, prelude
auto-import, the optimizer, and the debug shadow oracle). Only output
lines past a high-water mark are surfaced, so each eval appears
incremental. This gives zero semantic divergence between the REPL and
real programs by construction, and makes source
a valid, runnable .lg program at every moment (:save = a program).
A failing input rolls back: the offending chunk is popped and the high-water mark stays put, so the session never wedges and never duplicates output.
§The replay caveat
Re-running the whole program re-executes side effects. Deterministic
programs are unaffected (their prior output is suppressed by the
high-water mark), but non-deterministic operations — current time,
random numbers, file or network I/O — are re-evaluated on every eval,
so a binding like Let t be the current time. drifts across lines.
reset is the escape hatch; a seeded replay mode
is the growth path.
Structs§
- Repl
Outcome - The outcome of one REPL evaluation.
- Repl
Session - A persistent imperative REPL session. See the module docs for the replay architecture.