Skip to content

exec

Convenience helpers for the common “compile if needed, cache, then execute” workflow.

Functions

run path :app? :prelude?

Compile path in script mode if needed, cache the bytecode, and execute it.

app scopes the cache directory under fs.cache_dir(). When omitted, the scope defaults from sys.program.

prelude is passed through to compile.compile.

Example
import exec

exec.run "./tool.dol"
exec.run "./tool.dol" app: "my-tool"

module path :name? :app? :prelude?

Compile path in module mode if needed, cache the bytecode, and return the loaded module object.

name defaults to the source file stem when omitted.

app scopes the cache directory under fs.cache_dir(). When omitted, the scope defaults from sys.program.

prelude is passed through to compile.compile.

Example
import exec

let mod = exec.module "./lib/build.dol"
mod.main()

let plugin = exec.module "./plugin.dol" name: "plugins.build"