Skip to main content

Module method

Module method 

Source
Expand description

The static mirror of the builtin method dispatch tables.

Method-call syntax (value.name(args)) dispatches to a builtin function when name is a registered method, and otherwise falls through to a closure stored under that name on the receiver. Read-only classification has to make that distinction before any engine resolves the call: a builtin method writes nothing the classifier cannot already see in its arguments, while an unregistered name invokes a runtime value whose body is invisible, so it must be over-approximated as writable.

BUILTIN_METHOD_NAMES mirrors the names registered by the executor’s method registry (build_method_registry in the core crate), which cannot be consulted from here without inverting the crate dependency. A test in that module asserts the two stay identical.

It lives in this layer rather than the expression layer because both the surface AST and the expression tree classify a method call the same way.

Constants§

BUILTIN_METHOD_NAMES
Every method name that dispatches to a builtin function, sorted so membership is a binary search.

Functions§

is_builtin_method
Whether name in value.name(args) dispatches to a builtin function rather than a closure stored on the receiver.
is_writer_builtin
Whether the named builtin can evaluate arbitrary nested statements, and so needs a write transaction whatever its arguments look like.