R/MRatCalcpowered by RiX

RiX walkthrough 10

Scripts and extensions

RiX modules, host boundaries, and language extension.

Orientation

RiX scripts can declare interfaces, import other RiX files, and run inside capability frames. JavaScript modules and language extensions are host-level features with explicit trust boundaries.

Prerequisites: Functions, Scope and imports, and System capabilities. Start with RiX scripts for a program you want to reuse. Read JavaScript modules only when a host needs to provide behavior from JavaScript, and Language extensions when changing parsing or dispatch. JavaScript-to-RiX gotchas is optional early reading for experienced programmers.

The small runnable cell checks the language context; the following pages describe what a script host must provide.

A worked example

Runnable RiX

The final line is the displayed value; the earlier lines set up the experiment. Keep the setup visible so you can tell whether a name, a cell, or a collection is being reused when the expression changes.

Read the result

RatCalc intentionally does not execute arbitrary local JavaScript modules in the browser.

Prototype a calculation in a browser cell, then record any file or capability requirement separately.

Keep going

Continue with RiX scripts for imports and interfaces.