Reference
Configuration
Receiver closures, the builder function around one, and the receiver script and sandbox that let a whole file play the same role - statically typed configuration without a second language.
A receiver closure, a builder, a receiver script and a sandbox are one mechanism at four sizes: a block, a function, a file, and the capabilities a file is allowed to reach.
What belongs here#
What does not belong here: property commands, which are a rule of the type system and live in language/types/.
Every page in this folder is a reference page: an example first, then the syntax, then numbered rules, then what the
construct is not. Receiver scripts and the sandbox are status: planned
until the runtime has them.
Pages#
- Receiver closures - A receiver closure is a closure whose first parameter is called self, so names inside it resolve against that receiver first, exactly as inside a method.
- Builders and DSLs - A builder is a function that creates a value, hands it to a receiver closure to configure, and returns it, which is what makes a configuration block a statically typed value instead of a string to parse.
- Receiver scripts (draft) - A .trb file can be loaded as the body of a receiver closure, type checked against a receiver type before it runs, and run by the sandboxed VM.
- The sandbox (draft) - A script has no IO, no network, no clock, no environment and no foreign functions by default, and only the caller of Sandbox.load can grant more, in a block that names exactly what is granted.