pub struct BopFn {
pub params: Vec<String>,
pub captures: Vec<(String, Value)>,
pub body: FnBody,
pub self_name: Option<String>,
}Expand description
A Bop function value — the runtime representation of a closure
or a reified fn foo(...) { ... } declaration. Shared by Rc
so first-class usage (let g = f; pass(f)) is cheap.
The body is engine-opaque: the tree-walker produces an
FnBody::Ast for direct interpretation; the bytecode VM
produces an FnBody::Compiled carrying a pre-compiled body.
Each engine only ever dispatches its own variant.
Fields§
§params: Vec<String>§captures: Vec<(String, Value)>Values captured from the enclosing scope at construction time, cloned by value. Free variables in the body that aren’t parameters and aren’t in this list fall through to the outer module / global lookup at call time.
body: FnBody§self_name: Option<String>Some(name) when this BopFn is bound to its own name
for self-reference (the lowering of fn foo(...) { ... }).
Lambdas created from an fn(...) { ... } expression leave
this None.