reflect.call_any

Calls `f` with `args`, every argument keyed by parameter name (a nameless positional is addressed by its `$argN` placeholder), checked at runtime against `f`'s signature: a missing required parameter, a key naming no parameter, or a value that does not fit its parameter's type throws `InvalidArgumentError`. The returned value is checked against `R` at the same boundary (except when `R` is `unknown`). An absent optional fires the callee's own default. `R` and `E` are `f`'s `Returns`/`Throws` pins, so a pinned `AnyFunction<Returns = json, Throws = ToolError>` yields typed results and an exhaustive catch; a bare `AnyFunction` returns `unknown` and throws `unknown` (which covers `InvalidArgumentError` and `reflect.errors.CompilationError`).

Reference version

Signature

function reflect.call_any<R, E>(
f: reflect.AnyFunction<Returns = R, Throws = E>,
args: map<string, unknown>

Calls f with args, every argument keyed by parameter name (a nameless positional is addressed by its $argN placeholder), checked at runtime against f's signature: a missing required parameter, a key naming no parameter, or a value that does not fit its parameter's type throws InvalidArgumentError. The returned value is checked against R at the same boundary (except when R is unknown). An absent optional fires the callee's own default. R and E are f's Returns/Throws pins, so a pinned AnyFunction<Returns = json, Throws = ToolError> yields typed results and an exhaustive catch; a bare AnyFunction returns unknown and throws unknown (which covers InvalidArgumentError and reflect.errors.CompilationError).

Source:<builtin>/reflect/reflect.bamlbytes 17480–17677