Learn
How it works
Each of the four promises drawn as the mechanism that keeps it, and one real session at the terminal.
One session
The program below reads todo.txt, but its main declares only console. The checker refuses it and says what to write. After the fix it checks clean, renyi record runs it and writes run.json, and with the input file deleted renyi run --replay still answers every effect from the recording, narrated by --explain. Every line of output is what the binary printed.
module todo
purpose: Count the items of a to-do list.
import std.filesystem exposing Path, FileError
import std.console
public function main() or fails with FileError needs console
purpose: Print how many items the list holds.
let text be filesystem.read_text(Path("todo.txt")) otherwise fail
console.print("{text.lines().length()} items")
end
$ renyi check todo.ry
todo.ry:10:15: error [capability-missing]: `read_text` needs `filesystem.read`, which `main` does not declare
fix: add `needs filesystem.read` to the signature of `main`
$ sed -i 's/needs console/&, filesystem.read/' todo.ry
$ renyi check todo.ry
$ renyi record --to run.json todo.ry
3 items
renyi: recorded 2 calls to run.json
$ rm todo.txt
$ renyi run --replay run.json --explain todo.ry
Print how many items the list holds. (main)
filesystem.read read_text(path: "todo.txt") -> "milk\neggs\nbread\n"
console "3 items"
$
The signature is the grant
Every function says what it needs, and a need can be scoped to a path, a host or a variable, budgeted (at most 60 per minute) and guarded (only to). The checker refuses a body that uses a capability its head does not declare and names the fix; the declaration of main is the whole program’s grant. At run time every effect passes one boundary in the VM, which checks the actual path or host against the grant of the running call chain, so a read outside data/ fails with PermissionDenied. --deny, --allow-read and their kin narrow the grant further from the command line, without touching the program.
Every run is evidence
renyi record runs main and writes every effect the run makes, with its result, and the run manifest in the header: the toolchain, the code hash, the dependencies with their versions and hashes, the grant, the arguments, the outcome and the output hash. renyi run --replay runs the program again with every effect answered from the recording, so nothing is written or sent. renyi reproduce replays a recording under its manifest and compares the outcome and the output byte for byte, refusing a program whose code hash is not the manifest’s. --explain narrates a run through the purpose: clauses it passes, and a replays test pins a function to a recording.
Dependencies cannot widen
A package’s effect manifest is computed by the tool from its sources, not written by its author, and published with it. renyi add prints the effects a dependency brings; renyi update refuses a version whose effects widen unless --accept-effects is given, and even then takes it only when every main that reaches the package declares the new capability; renyi audit checks every locked dependency against every main that reaches it. On fetch every file is verified against its hash and the manifest recomputed, so a package cannot understate what it does.
One toolchain, written twice
One binary, renyi, written in Rust. The front end lexes, parses, checks and emits bytecode, and it exists twice: in Rust, and written in Renyi under compiler/ and run by the VM. Tests hold the two equal byte for byte (the syntax tree, the diagnostics and the bytecode file) on every program of the corpus, the conformance suite and the compiler itself. The VM runs a function on its template tier from the first call and moves hot code to Cranelift; --interpret keeps a run on the interpreter, as --explain and --profile do. renyi build compiles every function ahead into an image that run, record, test and reproduce load without compiling anything.