This document explains how the HLVM runtime resolves HQL modules, tracks circular imports, and exposes exports to user code.
// Named imports (vector style)
(import [foo bar] from "./lib/math.hql")
// Namespace import
(import math from "./lib/math.hql")
// Aliases
(import [foo as foo2, bar] from "./lib/math.hql")
The transpiler enforces the opinionated vector syntax described in the spec—no
string-based exports, no bare import foo forms.
run/runFile
and records currentFile so relative paths stay accurate.npm:, jsr:,
https://) are fetched in parallel..hlvm-cache for reuse within the
same session.Environment
as a stable object so circular imports see live bindings rather than copies.The runtime now supports circular import graphs out-of-the-box. The flow is:
Environment#importModule reuses the same object on
every call, so once the original module finishes evaluating, all importers
observe the updated values.// a.hql
(var base 10)
(import [inc] from "./b.hql")
(fn a-func [] (inc base))
(export [base])
(export [a-func])
// b.hql
(import [base] from "./a.hql")
(fn inc [value] (+ value base))
(export [inc])
(import [a-func] from "./a.hql")
(a-func) // → 20
The associated tests (test/syntax-circular.test.ts) cover single-hop and
multi-hop cycles.
(export [name])) expose existing bindings.npm:lodash@4) so builds
remain reproducible.