pub struct Function<A: IVm>(/* private fields */);Expand description
A function value: it can be called, it has a length, it has a text,
and it has an identity. Nothing else. It holds a VM’s own value, laid
out as Unpacked lays out every value, which the
VM constructs through its own capability, such as
IStaticFunction, and Function::new
wraps.
Compared by identity, an Rc in naive: every construction is a new
function, as JavaScript makes a new function of every evaluation of an
arrow, and (() => 1) === (() => 1) is false. A built-in is no kind
apart: it is a closure of the runtime value, vm::runtime, built once
and read from the value, so Object.is === Object.is holds because
both reads find the one closure, and its text is the NativeFunction
text the compiled runtime gave it (fjs/js/runtime/README.md, “How
NaNVM finds it”).
Implementations§
Trait Implementations§
Source§impl<A: IVm> Debug for Function<A>
A fixed marker: Debug is a Rust diagnostic, not a program value, so it
carries no text a program could observe.
impl<A: IVm> Debug for Function<A>
A fixed marker: Debug is a Rust diagnostic, not a program value, so it
carries no text a program could observe.