FunctionAccess
Source: detlef.mjs:200
Borrowed value/object access for an eager Function callback.
Must not be constructed, disposed, or saved for later use. Access expires when the callback returns. Native Functions cannot execute code, mutate variables, or register definitions, including through a captured Runtime.
Alias: FunctionAccess
Instance Methods
value(value: HostValue): Value
Wrap a JavaScript primitive as a DETLEF value, or borrow an existing Value.
Numbers become floats; integers require BigInt within the signed 64-bit range. A new wrapper is temporary inside a registered callback. Otherwise it must be disposed explicitly. Existing wrappers keep their original ownership.
Parameters
value(HostValue) — Primitive or Value from this runtime.
Returns
Value— New primitive wrapper, or the supplied Value unchanged.
Throws
Error— Unsupported input, out-of-range integer, disposed handle, or expired access.
array(elementType: TypeSpec, items?: Array.<HostValue>): Value
Create an array by copying the supplied values. Input wrappers are not consumed. The result follows the same temporary/host-owned lifetime as value().
Parameters
elementType(TypeSpec) — Element type, not the enclosing array type.items(Array.<HostValue>, optional, default: "[]") — Elements to copy.
Returns
Value— Array wrapper.
Throws
Error— Invalid type, non-array items, element type mismatch, or expired access.
record(type: string, fields?: Array.<HostValue>): Value
Create an instance of an existing record type. Input wrappers are not consumed. The result follows the same temporary/host-owned lifetime as value().
Parameters
type(string) — Name of a defined record type.fields(Array.<HostValue>, optional, default: "[]") — Values in field declaration order.
Returns
Value— Record wrapper.
Throws
Error— Unknown record, field count/type mismatch, or expired access.