The REPL evaluates code line by line and shares values between languages.
Terminal
bash
elide repl
elide with no arguments in a terminal also starts it. Languages: JavaScript, TypeScript, Python and WebAssembly.
One REPL session — JavaScript values used from Python
js ❯ const x = 5
js ❯ x
5
js ❯ /py
py ❯ import json; json.dumps({"x": x})
'{"x": 5}'
─────────────────────────────────────────────────────────────────────
py ❯
─────────────────────────────────────────────────────────────────────
session demo0001 • py • v1.6.0 seq 5
Commands
| Command | Effect |
|---|---|
/js, /ts, /py, /wasm |
Switch language. With an argument, evaluate it once in that language. |
/lang NAME |
Switch language. |
/export NAME |
Share a value with the other languages. |
/import NAME |
Bind a shared value in the current language. |
/history [N] |
Show recent entries. |
/reset |
Delete saved history. |
/clear |
Clear the screen. |
/help |
List commands. |
/exit |
Leave the REPL. |
Share values
text
const x = 41
/export x
/py
/import x
print(x + 1)
utf-8 · text · Lines: 5
text
42
utf-8 · text · Lines: 1
Sharing works without --interop.
In Tern
In a Tern terminal, elide repl draws its editor and results as a native view, with a language picker
(Ctrl+L); see Terminal surfaces. The Tern plugin’s Open REPL opens a notebook
where JavaScript and Python share live values; see REPL notebook.