Skip to main content

Module registry

Module registry 

Source
Expand description

Function registry: known function signatures for DSL validation.

Each registered function declares its name, category, expected wire inputs, constant parameters, output count, and variadic behavior. The compiler uses this to validate calls at parse time and to generically dispatch variadic functions.

Categories are a type-safe enum — every function must declare one. Categories group the registry for listings (by_category). The stdlib files carry a // @category: Name line for readers; FuncCategory::parse maps that text but no compile path consumes it.

Signatures are owned by their respective node modules. This file defines the shared types and the collector function.

Structs§

FactoryRegistration
A host’s own NodeFactory, linked into the registry.
FuncSig
Description of a registered function’s signature.
NodeRegistration
A node module’s registration: signatures + builder.
Overload
A function name that stands for one node per argument type, as vec_dot stands for vec_dot_f32 and vec_dot_f64 (polydat_grammar.md §18.1, T-Call-OverloadResolve).
OverloadForm
One form of an Overload: the registered function a call builds when its wires have these types. Built with OverloadForm::new.
ParamSpec
Describes one parameter in a function’s call signature.

Enums§

Arity
Arity specification for a function signature.
CompileLevel
The maximum compilation level a node supports.
DefaultResolver
Auto-resolver kind attached to handle-taking functions. Tells the binding compiler which resolver to splice in when a string source is wired to a handle input port.
FuncCategory
Functional category for a Polydat node function.
OutputType
Output-type contract for a registered function.

Functions§

by_category
Return functions grouped by category in display order.
factories
Every factory linked into the registry: each node module’s NodeRegistration, then each host FactoryRegistration. A function name belongs to the first factory whose signatures list it.
lookup
The signature of what a program calls by name: the registered function name, or, for an Overload such as vec_dot, its first form’s (Overload::signature), whose parameters every form shares. None means no call to name can build. For an overload the signature’s name is the form’s, such as vec_dot_f32; resolve_call names the form a call with given wire types builds, and lookup_registered answers only for registered functions. Every factory is 'static, so its signatures are too, and no allocation is needed.
lookup_registered
Find a registered function by its exact name: the signature of the factory that builds it. Unlike lookup, it answers None for an overloaded name, which no factory builds itself.
overload
The overloaded name name, if it is one.
overloads
Every overloaded name linked into the registry.
overloads_by_category
Every overloaded name, grouped by its Overload::category in display order and sorted by name within a category: the names by_category leaves out, since it lists registered functions. A listing of what a program can call shows both.
registry
Return the full registry of known functions: the signatures of every linked factory (factories).
resolve_call
The function a call to name with wires of wire_types builds: the resolved form when name is an Overload, name itself otherwise.
suggest_function
Find the closest function name to a misspelling, among the registered functions and the Overload names.
unlisted_overloads
Every overload whose first form names no registered function, sorted by name: a registration error, such as a misspelled form or a form whose module is not linked. lookup answers None for these names and overloads_by_category lists them under FuncCategory::Uncategorised, so a host checks that this is empty, in a test or at startup, to find its own broken registrations.

Type Aliases§

NodeBuildFn
Builder for a node module: (build context, name, wires, resolved wire port types, const args) -> Some(Ok(node)) / Some(Err(msg)), or None when the name isn’t handled by this module. The build context carries the bindings under construction and the program tree’s resource scope (crate::dsl::factory::BuildContext).