Open Manual

REPL

The REPL evaluates Nytrix source interactively. It keeps imports, definitions,

and lazy-loaded modules between prompts, so file execution remains the cleaner

record for bugs, tests, and benchmarks.

Start

ny
ny -i
ny --interactive
ny --plain-repl
ny -ic 'a=1337'
ny --repl < file.ny

--plain-repl uses plain terminal input. --repl reads stdin as source once;

prompt commands such as :help, :snapshot, and :load are interactive-only.

Use

TaskForm
Evaluate expressionType it directly.
Import a moduleuse module.path
Search APIsny doc search --symbols name
Inspect a conceptny doc search --docs topic
Reproduce exactlyMove the snippet to a file and run ny file.ny.

Example:

use std.core
use std.math

fn midpoint(number a, number b) number {
   (a + b) / 2
}

assert(midpoint(2, 6) == 4, "midpoint")

State Model

A REPL session may already contain:

For file-equivalent diagnostics:

ny --diag-rich file.ny
ny -run file.ny
ny fmt --check file.ny

comptime{ ... } follows normal import rules in the REPL: session imports are

visible, immutable compile-time constants can be reused, and runtime globals

are not captured.

Imports And Completion

Owning-module imports keep completion and file behavior aligned:

use std.math
abs(10)

use std.math as math
math.abs(10)

Receiver completion depends on the imported API and the receiver shape:

[1, 2, 3].len

Indexed loops bind value first, index second:

for ch, i in "test" { print(f"{ch}:{i}") }

One-Shot Probes

Use -c for source strings that do not need prompt state:

ny -c 'use std.math
assert(abs(10) == 10, "abs")'

Use files for quotes, multiline source, imports, packages, native declarations,

and reproducible output.

Snapshots

ny> def doc_value = 7
ny> :snapshot app.nys
ny> :load app.nys
ny> doc_value
7

Use :snapshot app.nys -o app to export through the native AOT path.

Debug Loop

SymptomNext command
Unknown nameny doc search --symbols name
Import shape unclearny doc search --docs import
Type mismatchny --diag-rich file.ny
REPL/file disagreementny file.ny then ny -run file.ny
Formatter issueny fmt --check file.ny
Parser issueny -dump-tokens file.ny or ny --expand file.ny
Slow pasteMove to a file and run ny -time file.ny.

Transcript Rule

A useful transcript records imports, source, result or diagnostic, and no

hidden setup.

Related