Guide
Hello
The smallest complete DriftScript program, and what it means that it needs no host at all.
The smallest complete program in this language imports nothing and needs no host. That is worth starting with, because it is the property everything else rests on: DriftScript is a language first and this engine is the first thing to host it.
A function and a string
A declaration, a return type, and a value. It links against a target that provides no capabilities at all, which is what "runs in any host" means when it is checked rather than claimed.
// The smallest complete DriftScript program.
//
// It imports nothing, so it links against a target that provides no capabilities at all. That is
// what "the language runs in any host" means in practice rather than in prose.
fn hello() -> String {
return "hello, world"
}
What the compiler gives back
Compiling a file produces a JavaScript module, a source map, and metadata saying which capabilities the file requires. The module is what runs; the metadata is what a host checks before it binds anything, so a missing capability is reported at bind time rather than at the first call, deep in a frame.