pub struct Lambda {
pub(crate) chunk: Chunk,
pub(crate) name: Option<SmolStr>,
pub(crate) upvalue_count: usize,
pub(crate) formals: Option<Formals>,
}
Expand description
The opcodes for a thunk or closure, plus the number of
non-executable opcodes which are allowed after an OpThunkClosure or
OpThunkSuspended referencing it. At runtime Lambda
is usually wrapped
in Rc
to avoid copying the Chunk
it holds (which can be
quite large).
In order to correctly reproduce cppnix’s “pointer equality”
semantics it is important that we never clone a Lambda –
use Rc<Lambda>::clone()
instead. This struct deliberately
does not derive(Clone)
in order to prevent this from being
done accidentally.
Fields§
§chunk: Chunk
§name: Option<SmolStr>
Name of the function (equivalent to the name of the identifier (e.g. a value in a let-expression or an attribute set entry) it is located in).
upvalue_count: usize
Number of upvalues which the code in this Lambda closes
over, and which need to be initialised at
runtime. Information about the variables is emitted using
data-carrying opcodes (see [crate::opcode::OpCode::DataStackIdx
]).
formals: Option<Formals>