Closures
Closures are a combination of one callable and some variables. They are meant to simplify interfaces and code around places where it was important for functions to have access to call-invariant (same on every call) data.
Closures can be created from both SGScript and the C API, though both options have their limitations.
- In SGScript, closures can be created by letting functions "use" a variable, e.g. by writing
function func( args ) use( closures ){ ..body.. }