| Tool | Version | Used for |
|---|---|---|
| Node.js | 24 | Vite, tests |
| pnpm | 10 | packages |
| Guile | 3.0.11 | runs the Hoot compiler |
| Hoot | 0.9.0 | compiles Scheme to WebAssembly |
guildmust be onPATH, and Hoot's modules onGUILE_LOAD_PATH.- Live development needs Hoot built from its
mainbranch: its interpreter supports record types, which 0.9.0's does not.
Hoot installs Guile with it:
| System | Command |
|---|---|
| macOS | brew tap aconchillo/guile && brew install guile-hoot |
| Debian (testing, unstable) | apt install guile-hoot |
| Guix | guix shell guile guile-hoot |
- Homebrew: run
brew unlink guilefirst if Guile is already installed. - Other systems, or Hoot's
mainbranch: build from source.
Check it works:
guild compile-wasm --helptooling/vite-plugin-roost.js only automates steps you can do by hand:
- Compiles
.scmentries withguild compile-wasm. The entry's directory is on the load path, so an application's own modules live next to it. - Imports the npm packages named in
(js/module "…")calls. - Serves Hoot's runtime files, and copies them into builds with Hoot's license.
- Strips debug information from built applications, about a fifth of the wasm. Compiled procedures then print as
#<procedure>, without their names. Development keeps it. - Live development: see Live development.
1. Compile the application, and copy Hoot's runtime files next to it:
guild compile-wasm -L <roost>/modules -L . --bundle -o public/app.wasm main.scm-L . lets main.scm import the application's own modules, such as (store cart) from store/cart.scm.
2. Load Hoot's reflect.js as a classic script, then start the application with the loader:
<div id="root"></div>
<script src="/reflect.js"></script>
<script type="module" src="/main.js"></script>import * as React from 'react'
import * as ReactDOMClient from 'react-dom/client'
import { boot } from '<roost>/js/roost-loader.js'
boot({
Scheme, // defined by reflect.js
wasm: '/app.wasm',
reflectWasmDir: '',
modules: { react: React, 'react-dom/client': ReactDOMClient },
})Register every package the Scheme code passes to js/module in modules.
3. Optionally, strip the debug information, as the plugin does for builds:
hoot strip public/app.wasmIt writes the debug information to public/app.debug.wasm; do not deploy that file.
4. License: the build includes Hoot's runtime (Apache-2.0). Ship Hoot's license with it.