print / printErr
Elide does not currently install shell-style print / printErr global functions for guest
scripts. The GraalJS js.shell option that would install them is not set, so print and
printErr are not present on globalThis in a normal elide run — use console.log /
console.error instead. The behavior described below is the intended d8 / SpiderMonkey / GraalJS
shell semantics for if/when these globals are enabled.
| Global | Stream | Description |
|---|---|---|
print(...args) | stdout | Writes the arguments, joined by a single space, followed by one newline. |
printErr(...args) | stderr | Same formatting as print, but to the standard error stream. |
" "). A single trailing newline ("\n") is
appended.
js
print("a", 1, true); // stdout: "a 1 true\n"
print(); // stdout: "\n"
printErr("warn:", 42); // stderr: "warn: 42\n"Difference from console
print is not an alias for console.log. console.log applies Node-style
formatting (format specifiers, object inspection, color) and is intended for
diagnostic output; print performs only the simple space-join shown above and
writes raw text. Use console for structured application logging and print
for plain stdout writes.
Notes
- These globals are not present in Node.js; they are a shell convention. Guest code that defines its own
printshadows the global as usual. - The functions write to the realm's configured output and error streams — the same streams used by
console.logandconsole.error.