Skip to content

Capabilities

Access is denied by default. A program declares each capability it needs at the top of the file:

use fs.read "data"
use fs.write "out"

Writing to stdout and stderr is always allowed. net.host, env and time are parsed in v0.1 but have no builtins until v0.2.

  • At compile time. Calling an effectful builtin without the matching use is C001. When the path is a string literal, the checker verifies that a declared prefix covers it (C002).
  • At run time. When the path is computed, Tlön checks it before the call and traps with R003. A path assembled to escape the prefix is still caught:
use fs.read "data"
fn main -> res unit str
let p cat "data/" "../x"
let text try read p
ok nil
{"code":"R003","severity":"error","node":"n12","msg":"capability violation"}

Prefixes are relative or absolute POSIX paths, normalized before comparison. .. is never covered. An empty prefix, a prefix with .., or a file capability without a path is C003.

aleph explain lists every capability of a program first, so a person can approve what a program may touch without reading its code.